Skip to content

Commit

Permalink
fix: unit tests failed because of missing mocked call
Browse files Browse the repository at this point in the history
  • Loading branch information
tpetry committed Sep 13, 2024
1 parent de22835 commit 5ad95bd
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions tests/MysqlExplainTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@
namespace Tpetry\MysqlExplain\Tests;

use Illuminate\Database\ConnectionInterface;
use Illuminate\Database\QueryException;
use Illuminate\Support\Facades\DB;
use Mockery\MockInterface;
use RuntimeException;
use Tpetry\MysqlExplain\Exceptions\NotMysqlException;
use Tpetry\MysqlExplain\Helpers\ApiHelper;
use Tpetry\MysqlExplain\Helpers\DatabaseHelper;
Expand Down Expand Up @@ -41,6 +43,9 @@ public function testSubmitQueryCollectsMetricsAndSubmitsThem(): void
$mock->shouldReceive('driverName')
->with($connection)
->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()));
$mock->shouldReceive('queryScalar')
->withArgs([$connection, 'SELECT VERSION()'])
->andReturn('...version...');
Expand Down

0 comments on commit 5ad95bd

Please sign in to comment.