Skip to content

Commit 0d526a5

Browse files
authored
Merge pull request #3 from netsells/feature/add-laravel-10-support
feature/add-laravel-10-support
2 parents 9189f41 + 61d80b8 commit 0d526a5

File tree

5 files changed

+22
-10
lines changed

5 files changed

+22
-10
lines changed

.github/workflows/tests.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
fail-fast: false
1313
matrix:
1414
php: ['8.1']
15-
laravel: ['^9.1']
15+
laravel: ['^9.1', '^10.0']
1616

1717
steps:
1818
- name: Checkout the repo

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@
2121
],
2222
"require": {
2323
"php": "^8.1",
24-
"laravel/framework": "^9.3"
24+
"laravel/framework": "^9.3 || ^10.0"
2525
},
2626
"require-dev": {
27-
"orchestra/testbench": "^7.7",
27+
"orchestra/testbench": "^7.7 || ^8.0",
2828
"spatie/fork": "^1.1"
2929
},
3030
"autoload": {

tests/Integration/AbstractIntegrationTest.php renamed to tests/Integration/AbstractIntegrationTestCase.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
use Netsells\LaravelMutexMigrations\ServiceProvider;
66
use Orchestra\Testbench\TestCase;
77

8-
abstract class AbstractIntegrationTest extends TestCase
8+
abstract class AbstractIntegrationTestCase extends TestCase
99
{
1010
protected function getPackageProviders($app): array
1111
{

tests/Integration/CommandConcurrencyTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
use Illuminate\Contracts\Console\Kernel;
77
use Spatie\Fork\Fork;
88

9-
class CommandConcurrencyTest extends AbstractIntegrationTest
9+
class CommandConcurrencyTest extends AbstractIntegrationTestCase
1010
{
1111
public function testCommandCanBeCalledConcurrently(): void
1212
{

tests/Unit/Mutex/MutexRelayTest.php

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
use Illuminate\Contracts\Cache\LockTimeoutException;
99
use Illuminate\Database\QueryException;
1010
use Illuminate\Filesystem\Filesystem;
11+
use Illuminate\Foundation\Application;
1112
use Netsells\LaravelMutexMigrations\Mutex\DatabaseCacheTableNotFoundException;
1213
use Netsells\LaravelMutexMigrations\Mutex\MutexRelay;
1314
use Netsells\LaravelMutexMigrations\Tests\Unit\Mutex\Fixtures\TestPDOException;
@@ -41,11 +42,7 @@ public function testAcquireLockHandlesMissingCacheTable(): void
4142

4243
$store->expects($this->once())
4344
->method('lock')
44-
->willThrowException(new QueryException(
45-
'select * from ' . MutexRelay::DEFAULT_LOCK_TABLE,
46-
[],
47-
new TestPDOException('Base table or view not found', '42S02')
48-
));
45+
->willThrowException($this->getQueryException());
4946

5047
$this->expectException(DatabaseCacheTableNotFoundException::class);
5148

@@ -110,4 +107,19 @@ public function testReleaseLockUnblocksOtherRelays(): void
110107

111108
$this->assertTrue($relay2->acquireLock());
112109
}
110+
111+
private function getQueryException(): QueryException
112+
{
113+
$arguments = [
114+
'select * from ' . MutexRelay::DEFAULT_LOCK_TABLE,
115+
[],
116+
new TestPDOException('Base table or view not found', '42S02')
117+
];
118+
119+
if (version_compare(Application::VERSION, '10.0.0', '>=')) {
120+
array_unshift($arguments, 'test-connection');
121+
}
122+
123+
return new QueryException(...$arguments);
124+
}
113125
}

0 commit comments

Comments
 (0)