Skip to content

Commit 5ad95bd

Browse files
committed
fix: unit tests failed because of missing mocked call
1 parent de22835 commit 5ad95bd

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

tests/MysqlExplainTest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@
55
namespace Tpetry\MysqlExplain\Tests;
66

77
use Illuminate\Database\ConnectionInterface;
8+
use Illuminate\Database\QueryException;
89
use Illuminate\Support\Facades\DB;
910
use Mockery\MockInterface;
11+
use RuntimeException;
1012
use Tpetry\MysqlExplain\Exceptions\NotMysqlException;
1113
use Tpetry\MysqlExplain\Helpers\ApiHelper;
1214
use Tpetry\MysqlExplain\Helpers\DatabaseHelper;
@@ -41,6 +43,9 @@ public function testSubmitQueryCollectsMetricsAndSubmitsThem(): void
4143
$mock->shouldReceive('driverName')
4244
->with($connection)
4345
->andReturn('mysql');
46+
$mock->shouldReceive('queryScalar')
47+
->withArgs([$connection, 'SELECT * FROM seq_1_to_1'])
48+
->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()));
4449
$mock->shouldReceive('queryScalar')
4550
->withArgs([$connection, 'SELECT VERSION()'])
4651
->andReturn('...version...');

0 commit comments

Comments
 (0)