From 20c0be003e59181735697c625d59f8dff6293935 Mon Sep 17 00:00:00 2001 From: Tom Moore Date: Fri, 24 Mar 2023 14:34:49 +0000 Subject: [PATCH 1/4] Update package dependencies --- composer.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index d529cc7..6ea45c2 100644 --- a/composer.json +++ b/composer.json @@ -21,10 +21,10 @@ ], "require": { "php": "^8.1", - "laravel/framework": "^9.3" + "laravel/framework": "^9.3 || ^10.0" }, "require-dev": { - "orchestra/testbench": "^7.7", + "orchestra/testbench": "^7.7 || ^8.0", "spatie/fork": "^1.1" }, "autoload": { From f6e4b6a0e2abce442f1f1111039ee80062426e0b Mon Sep 17 00:00:00 2001 From: Tom Moore Date: Fri, 24 Mar 2023 14:35:16 +0000 Subject: [PATCH 2/4] Prevent abstract test case warning --- ...tractIntegrationTest.php => AbstractIntegrationTestCase.php} | 2 +- tests/Integration/CommandConcurrencyTest.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename tests/Integration/{AbstractIntegrationTest.php => AbstractIntegrationTestCase.php} (83%) diff --git a/tests/Integration/AbstractIntegrationTest.php b/tests/Integration/AbstractIntegrationTestCase.php similarity index 83% rename from tests/Integration/AbstractIntegrationTest.php rename to tests/Integration/AbstractIntegrationTestCase.php index 94c7fdc..ad2f97b 100644 --- a/tests/Integration/AbstractIntegrationTest.php +++ b/tests/Integration/AbstractIntegrationTestCase.php @@ -5,7 +5,7 @@ use Netsells\LaravelMutexMigrations\ServiceProvider; use Orchestra\Testbench\TestCase; -abstract class AbstractIntegrationTest extends TestCase +abstract class AbstractIntegrationTestCase extends TestCase { protected function getPackageProviders($app): array { diff --git a/tests/Integration/CommandConcurrencyTest.php b/tests/Integration/CommandConcurrencyTest.php index eca933e..29c3bb1 100644 --- a/tests/Integration/CommandConcurrencyTest.php +++ b/tests/Integration/CommandConcurrencyTest.php @@ -6,7 +6,7 @@ use Illuminate\Contracts\Console\Kernel; use Spatie\Fork\Fork; -class CommandConcurrencyTest extends AbstractIntegrationTest +class CommandConcurrencyTest extends AbstractIntegrationTestCase { public function testCommandCanBeCalledConcurrently(): void { From 19310e7af321f18fa4e05c69c2b6075912267dfa Mon Sep 17 00:00:00 2001 From: Tom Moore Date: Fri, 24 Mar 2023 15:48:31 +0000 Subject: [PATCH 3/4] Fix version incompatibilities in QueryException --- tests/Unit/Mutex/MutexRelayTest.php | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/tests/Unit/Mutex/MutexRelayTest.php b/tests/Unit/Mutex/MutexRelayTest.php index c21ce53..fc70597 100644 --- a/tests/Unit/Mutex/MutexRelayTest.php +++ b/tests/Unit/Mutex/MutexRelayTest.php @@ -8,6 +8,7 @@ use Illuminate\Contracts\Cache\LockTimeoutException; use Illuminate\Database\QueryException; use Illuminate\Filesystem\Filesystem; +use Illuminate\Foundation\Application; use Netsells\LaravelMutexMigrations\Mutex\DatabaseCacheTableNotFoundException; use Netsells\LaravelMutexMigrations\Mutex\MutexRelay; use Netsells\LaravelMutexMigrations\Tests\Unit\Mutex\Fixtures\TestPDOException; @@ -41,11 +42,7 @@ public function testAcquireLockHandlesMissingCacheTable(): void $store->expects($this->once()) ->method('lock') - ->willThrowException(new QueryException( - 'select * from ' . MutexRelay::DEFAULT_LOCK_TABLE, - [], - new TestPDOException('Base table or view not found', '42S02') - )); + ->willThrowException($this->getQueryException()); $this->expectException(DatabaseCacheTableNotFoundException::class); @@ -110,4 +107,19 @@ public function testReleaseLockUnblocksOtherRelays(): void $this->assertTrue($relay2->acquireLock()); } + + private function getQueryException(): QueryException + { + $arguments = [ + 'select * from ' . MutexRelay::DEFAULT_LOCK_TABLE, + [], + new TestPDOException('Base table or view not found', '42S02') + ]; + + if (version_compare(Application::VERSION, '10.0.0', '>=')) { + array_unshift($arguments, 'test-connection'); + } + + return new QueryException(...$arguments); + } } From 61d80b89d7ccdd13bec98cb73170f7687a1bf14d Mon Sep 17 00:00:00 2001 From: Tom Moore Date: Fri, 24 Mar 2023 15:50:37 +0000 Subject: [PATCH 4/4] Update github workflow to include laravel 10 --- .github/workflows/tests.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index c01b882..2b9d4cc 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -12,7 +12,7 @@ jobs: fail-fast: false matrix: php: ['8.1'] - laravel: ['^9.1'] + laravel: ['^9.1', '^10.0'] steps: - name: Checkout the repo