Skip to content

Commit

Permalink
Laravel 10 support
Browse files Browse the repository at this point in the history
  • Loading branch information
FrittenKeeZ committed Apr 4, 2023
1 parent c7cc774 commit cc785df
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 14 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ jobs:
strategy:
fail-fast: false
matrix:
php: [8.1, 8.0, 7.4]
testbench: [7.0, 6.23]
php: [8.2, 8.1, 8.0, 7.4]
testbench: [8.0, 7.0, 6.23]
version: [prefer-stable, prefer-lowest]
include:
- version: prefer-stable
Expand All @@ -35,6 +35,10 @@ jobs:
exclude:
- php: 7.4
testbench: 7.0
- php: 7.4
testbench: 8.0
- php: 8.0
testbench: 8.0

runs-on: ubuntu-latest

Expand Down
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,16 @@
],
"require": {
"php": "^7.4|^8.0",
"illuminate/validation": "^8.0|^9.0",
"illuminate/validation": "^8.0|^9.0|^10.0",
"meilisearch/meilisearch-php": ">=0.24.0 <=0.26.0"
},
"require-dev": {
"brick/varexporter": "^0.3.5",
"guzzlehttp/guzzle": "^7.4",
"http-interop/http-factory-guzzle": "^1.2",
"illuminate/support": "^8.69|^9.0",
"illuminate/support": "^8.69|^9.0|^10.0",
"laravel/scout": "^9.0",
"orchestra/testbench": "^6.5|^7.0",
"orchestra/testbench": "^6.5|^7.0|^8.0",
"php-http/discovery": "^1.12",
"phpunit/phpunit": "^9.4"
},
Expand Down
11 changes: 8 additions & 3 deletions tests/Actions/SynchronizesModelTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,14 @@ public function testWithInvalidModel(): void
*/
public function testWithInvalidSettings(): void
{
$message = version_compare(app()->version(), '9.0.0', '<')
? 'The given data was invalid.'
: 'The distinct attribute must be a string.';
$version = app()->version();
$message = 'The distinct attribute field must be a string.';
if (version_compare($version, '10.0.0', '<')) {
$message = 'The distinct attribute must be a string.';
}
if (version_compare($version, '9.0.0', '<')) {
$message = 'The given data was invalid.';
}
$this->expectException(ValidationException::class);
$this->expectExceptionMessage($message);

Expand Down
22 changes: 16 additions & 6 deletions tests/Commands/ModelsSynchronizeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,14 @@ public function testWithAdvancedSettings(): void
$details = $this->app->make(DetailsModel::class)(MeiliMovie::class);
$this->assertSame($defaults, $details);

$message = version_compare(app()->version(), '9.0.0', '<')
? 'The given data was invalid.'
: 'The distinct attribute must be a string.';
$version = app()->version();
$message = 'The distinct attribute field must be a string.';
if (version_compare($version, '10.0.0', '<')) {
$message = 'The distinct attribute must be a string.';
}
if (version_compare($version, '9.0.0', '<')) {
$message = 'The given data was invalid.';
}

$this->artisan('meili:models:synchronize')
->expectsOutput('Processed ' . BrokenMovie::class)
Expand Down Expand Up @@ -92,9 +97,14 @@ public function testWithPretend(): void
$namespace = 'Dwarf\\MeiliTools\\Tests\\Models';
config(['meilitools.paths' => [$path => $namespace]]);

$message = version_compare(app()->version(), '9.0.0', '<')
? 'The given data was invalid.'
: 'The distinct attribute must be a string.';
$version = app()->version();
$message = 'The distinct attribute field must be a string.';
if (version_compare($version, '10.0.0', '<')) {
$message = 'The distinct attribute must be a string.';
}
if (version_compare($version, '9.0.0', '<')) {
$message = 'The given data was invalid.';
}

$this->artisan('meili:models:synchronize', ['--pretend' => true])
->expectsOutput('Processed ' . BrokenMovie::class)
Expand Down

0 comments on commit cc785df

Please sign in to comment.