Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
freekmurze committed Mar 8, 2024
1 parent b6f0fb6 commit 1ac01a9
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 31 deletions.
23 changes: 4 additions & 19 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,25 +12,10 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest]
php: [8.2, 8.1, 8.0]
laravel: ['8.*', '9.*', '10.*', '11.*']
php: [8.2]
laravel: ['10.*', '11.*']
dependency-version: [prefer-lowest, prefer-stable]
include:
- laravel: 10.*
testbench: ^8.0
- laravel: 8.*
testbench: ^6.6
- laravel: 9.*
testbench: 7.*
- laravel: 11.*
testbench: ^9.0
exclude:
- laravel: 10.*
php: 8.0
- laravel: 11.*
php: 8.1
- laravel: 11.*
php: 8.0


name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.dependency-version }} - ${{ matrix.os }}

Expand All @@ -53,7 +38,7 @@ jobs:

- name: Install dependencies
run: |
composer require "laravel/framework:${{ matrix.laravel }}" "nesbot/carbon:^2.63" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update
composer require "laravel/framework:${{ matrix.laravel }}" "nesbot/carbon:^2.63" --no-interaction --no-update
composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction --no-suggest
- name: Execute tests
Expand Down
9 changes: 4 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,12 @@
}
],
"require": {
"php": "^8.0|^8.1",
"illuminate/support": "^8.71|^9.0|^10.0|^11.0"
"php": "^8.2",
"illuminate/support": "^10.0|^11.0"
},
"require-dev": {
"orchestra/testbench": "^6.6|^7.0|^8.0|^9.0",
"pestphp/pest": "^1.22|^2.34",
"phpunit/phpunit": "^9.5|^10.5"
"orchestra/testbench": "^8.0|^9.0",
"pestphp/pest": "^2.34"
},
"autoload": {
"psr-4": {
Expand Down
21 changes: 14 additions & 7 deletions tests/HasStatusesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,20 +76,27 @@
->expect(fn () => $this->testModel->status()->reason)
->toBeNull();

it('can return the latest status', function () {
it('can return the latest status', function (

) {
$this->testModel
->setStatus('status 1')
->setStatus('status 3')
->setStatus('status 2')
->setStatus('status 1')
->setStatus('status 2');

expect([
$this->testModel->latestStatus('status 1', 'status 3'),
$this->testModel->latestStatus(['status 1', 'status 3']),
$this->testModel->latestStatus('status 1', 'status 2', 'status 3'),
$this->testModel->latestStatus('non existing status'),
])->sequence('status 1', 'status 1', 'status 2', null);
$model = $this->testModel->latestStatus('status 1', 'status 3');
expect($model->name)->toBe('status 1');

$model = $this->testModel->latestStatus(['status 1', 'status 3']);
expect($model->name)->toBe('status 1');

$model = $this->testModel->latestStatus('status 1', 'status 2', 'status 3');
expect($model->name)->toBe('status 2');

$model = $this->testModel->latestStatus('non existing status');
expect($model)->toBeNull();
});

it('will return `true` if specific status is found')
Expand Down

0 comments on commit 1ac01a9

Please sign in to comment.