Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions tests/ConnectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
namespace Yiisoft\Db\Sqlite\Tests;

use PDO;
use PHPUnit\Framework\MockObject\MockObject;
use Psr\Log\LoggerInterface;
use Psr\Log\NullLogger;
use Throwable;
use Yiisoft\Db\Connection\ConnectionInterface;
Expand All @@ -14,7 +16,6 @@
use Yiisoft\Db\Profiler\ProfilerInterface;
use Yiisoft\Db\Sqlite\Tests\Support\TestTrait;
use Yiisoft\Db\Tests\Common\CommonConnectionTest;
use Yiisoft\Db\Tests\Support\DbHelper;
use Yiisoft\Db\Transaction\TransactionInterface;

/**
Expand Down Expand Up @@ -45,7 +46,7 @@ public function testExceptionContainsRawQuery(): void
$db->setEmulatePrepare(true);

/* profiling and logging */
$db->setLogger(DbHelper::getLogger());
$db->setLogger($this->getLogger());
$db->setProfiler($this->createProfiler());

$this->runExceptionTest($db);
Expand All @@ -57,7 +58,7 @@ public function testExceptionContainsRawQuery(): void
$this->runExceptionTest($db);

/* logging only */
$db->setLogger(DbHelper::getLogger());
$db->setLogger($this->getLogger());
$db->setProfiler(null);

$this->runExceptionTest($db);
Expand Down Expand Up @@ -134,6 +135,11 @@ static function (ConnectionInterface $db) {
);
}

protected function getLogger(): LoggerInterface|MockObject
{
return $this->createMock(LoggerInterface::class);
}

/**
* @throws Throwable
*/
Expand Down