Skip to content

Commit

Permalink
Merge pull request #3 from netsells/feature/add-laravel-10-support
Browse files Browse the repository at this point in the history
feature/add-laravel-10-support
  • Loading branch information
tomchkk authored Mar 24, 2023
2 parents 9189f41 + 61d80b8 commit 0d526a5
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Integration/CommandConcurrencyTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
22 changes: 17 additions & 5 deletions tests/Unit/Mutex/MutexRelayTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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);
}
}

0 comments on commit 0d526a5

Please sign in to comment.