Skip to content

Commit

Permalink
fix: query exception had different parameters in old versions
Browse files Browse the repository at this point in the history
  • Loading branch information
tpetry committed Sep 13, 2024
1 parent e6dfe67 commit 64d5f44
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion tests/MysqlExplainTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

use Illuminate\Database\ConnectionInterface;
use Illuminate\Database\QueryException;
use Illuminate\Support\Facades\App;
use Illuminate\Support\Facades\DB;
use Mockery\MockInterface;
use RuntimeException;
Expand Down Expand Up @@ -45,7 +46,10 @@ public function testSubmitQueryCollectsMetricsAndSubmitsThem(): void
->andReturn('mysql');
$mock->shouldReceive('queryScalar')
->withArgs([$connection, 'SELECT * FROM seq_1_to_1'])
->andThrow(new QueryException("SQLSTATE[42S02]: Base table or view not found: 1146 Table 'seq_1_to_1' doesn't exist.", 'SELECT * FROM seq_1_to_1', [], new RuntimeException));
->andThrow(match (true) {
version_compare(App::version(), '10.0.0', '>=') => new QueryException('mysql', 'SELECT * FROM seq_1_to_1', [], new RuntimeException),
default => new QueryException('SELECT * FROM seq_1_to_1', [], new RuntimeException)
});
$mock->shouldReceive('queryScalar')
->withArgs([$connection, 'SELECT VERSION()'])
->andReturn('...version...');
Expand Down

0 comments on commit 64d5f44

Please sign in to comment.