diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index e777376..8a322a9 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -13,23 +13,46 @@ jobs: fail-fast: true matrix: os: [ubuntu-latest, windows-latest] - php: [8.1, 8.2] - laravel: [9.*, 10.*] - stability: [prefer-lowest, prefer-stable] + php: [8.1, 8.2, 8.3, 8.4] + laravel: [9.*, 10.*, 11.*, 12.*, 13.*] + stability: [prefer-stable] include: - laravel: 9.* testbench: 7.* + carbon: "*" - laravel: 10.* testbench: 8.* + carbon: "*" + - laravel: 11.* + testbench: 9.* + carbon: ">=3.8.4" + - laravel: 12.* + testbench: 10.* + carbon: ">=3.8.4" + - laravel: 13.* + testbench: 11.* + carbon: ">=3.8.4" exclude: - laravel: 9.* php: 8.2 + - laravel: 9.* + php: 8.3 + - laravel: 9.* + php: 8.4 + - laravel: 11.* + php: 8.1 + - laravel: 12.* + php: 8.1 + - laravel: 13.* + php: 8.1 + - laravel: 13.* + php: 8.2 name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }} steps: - name: Checkout code - uses: actions/checkout@v5 + uses: actions/checkout@v6 - name: Setup PHP uses: shivammathur/setup-php@v2 @@ -45,8 +68,11 @@ jobs: - name: Install dependencies run: | - composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update + composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" "nesbot/carbon:${{ matrix.carbon }}" --no-interaction --no-update composer update --${{ matrix.stability }} --prefer-dist --no-interaction + - name: List Installed Dependencies + run: composer show -D + - name: Execute tests - run: vendor/bin/pest + run: vendor/bin/pest --ci --no-coverage diff --git a/composer.json b/composer.json index 2df4028..2ecd3f2 100644 --- a/composer.json +++ b/composer.json @@ -22,15 +22,14 @@ }, "require-dev": { "laravel/pint": "^1.0", - "nunomaduro/collision": "^6.0|^7.0", - "nunomaduro/larastan": "^2.0.1", - "orchestra/testbench": "^7.0|^8.0", - "pestphp/pest": "^1.21", - "pestphp/pest-plugin-laravel": "^1.1", + "nunomaduro/collision": "^6.0|^7.0|^8.0", + "nunomaduro/larastan": "^2.0.1|^3.0", + "orchestra/testbench": "^7.0|^8.0|^9.0|^10.0|^11.0", + "pestphp/pest": "^1.21|^2.0|^3.7", "phpstan/extension-installer": "^1.1", - "phpstan/phpstan-deprecation-rules": "^1.0", - "phpstan/phpstan-phpunit": "^1.0", - "phpunit/phpunit": "^9.5|^10.0" + "phpstan/phpstan-deprecation-rules": "^1.0|^2.0", + "phpstan/phpstan-phpunit": "^1.0|^2.0", + "phpunit/phpunit": "^9.5|^10.0|^11.0" }, "autoload": { "psr-4": { diff --git a/config/laravel_ticket.php b/config/laravel_ticket.php index bb1c898..642af7f 100644 --- a/config/laravel_ticket.php +++ b/config/laravel_ticket.php @@ -1,5 +1,10 @@ [ - 'ticket' => \Coderflex\LaravelTicket\Models\Ticket::class, - 'message' => \Coderflex\LaravelTicket\Models\Message::class, - 'category' => \Coderflex\LaravelTicket\Models\Category::class, - 'label' => \Coderflex\LaravelTicket\Models\Label::class, - ] + 'ticket' => Ticket::class, + 'message' => Message::class, + 'category' => Category::class, + 'label' => Label::class, + ], ]; diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 3e9b2cc..7d4b75f 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -3,20 +3,15 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd" backupGlobals="false" - backupStaticAttributes="false" bootstrap="vendor/autoload.php" colors="true" - convertErrorsToExceptions="true" - convertNoticesToExceptions="true" - convertWarningsToExceptions="true" processIsolation="false" - stopOnFailure="false" executionOrder="random" failOnWarning="true" failOnRisky="true" failOnEmptyTestSuite="true" - beStrictAboutOutputDuringTests="true" - verbose="true" + cacheDirectory=".phpunit.cache" + backupStaticProperties="false" > diff --git a/src/Concerns/HasTickets.php b/src/Concerns/HasTickets.php index a4a61c1..d058e29 100644 --- a/src/Concerns/HasTickets.php +++ b/src/Concerns/HasTickets.php @@ -15,6 +15,7 @@ public function tickets(): HasMany 'laravel_ticket.models.ticket', parent::getTable() ); + return $this->hasMany($model, 'user_id'); } @@ -27,6 +28,7 @@ public function messages(): HasMany 'laravel_ticket.models.message', parent::getTable() ); + return $this->hasMany($model, 'user_id'); } } diff --git a/src/Concerns/HasVisibility.php b/src/Concerns/HasVisibility.php index 831b733..7697c74 100644 --- a/src/Concerns/HasVisibility.php +++ b/src/Concerns/HasVisibility.php @@ -10,7 +10,7 @@ trait HasVisibility /** * Determine whether if the model is visible * - * @return \Illuminate\Database\Eloquent\Builder + * @return Builder */ public function scopeVisible(Builder $builder) { @@ -20,7 +20,7 @@ public function scopeVisible(Builder $builder) /** * Determine whether if the model is hidden * - * @return \Illuminate\Database\Eloquent\Builder + * @return Builder */ public function scopeHidden(Builder $builder) { diff --git a/src/Concerns/InteractsWithTicketRelations.php b/src/Concerns/InteractsWithTicketRelations.php index be27289..2168a5b 100644 --- a/src/Concerns/InteractsWithTicketRelations.php +++ b/src/Concerns/InteractsWithTicketRelations.php @@ -3,6 +3,7 @@ namespace Coderflex\LaravelTicket\Concerns; use Illuminate\Database\Eloquent\Model; +use Illuminate\Support\Collection; trait InteractsWithTicketRelations { @@ -21,7 +22,7 @@ public function attachLabels($id, array $attributes = [], $touch = true) /** * Sync the intermediate tables with a list of IDs or collection of the ticket model.. * - * @param \Illuminate\Support\Collection|\Illuminate\Database\Eloquent\Model|array $ids + * @param Collection|Model|array $ids * @param bool $detaching * @return array */ @@ -45,7 +46,7 @@ public function attachCategories($id, array $attributes = [], $touch = true) /** * Sync the intermediate tables with a list of IDs or collection of the ticket model.. * - * @param \Illuminate\Support\Collection|\Illuminate\Database\Eloquent\Model|array $ids + * @param Collection|Model|array $ids * @param bool $detaching * @return array */ diff --git a/tests/Database/Migrations/create_users_table.php b/tests/Database/Migrations/create_users_table.php index 57f0097..d52f72d 100644 --- a/tests/Database/Migrations/create_users_table.php +++ b/tests/Database/Migrations/create_users_table.php @@ -4,7 +4,7 @@ use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -return new class() extends Migration +return new class extends Migration { public function up() {