Skip to content

Commit 13c19ab

Browse files
committed
Minor code tightening
This is a small change aimed at tightening up the test code. Removing items that are unnecessary, such as checking for the pdo_sqlite extension, and adding in required function arguments, to ensure that the code is as explicit as possible.
1 parent 49a38a5 commit 13c19ab

File tree

3 files changed

+7
-10
lines changed

3 files changed

+7
-10
lines changed

test/unit/AdapterServiceFactoryTest.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,6 @@ protected function createServiceManager(array $dbConfig): ServiceLocatorInterfac
3737
#[Override]
3838
protected function setUp(): void
3939
{
40-
if (! extension_loaded('pdo_sqlite')) {
41-
$this->markTestSkipped('Adapter factory tests require pdo_sqlite');
42-
}
43-
4440
$this->factory = new AdapterServiceFactory();
4541
}
4642

test/unit/AdapterTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ public function testMagicGet(): void
245245
protected function setUp(): void
246246
{
247247
$this->mockConnection = $this->createMock(ConnectionInterface::class);
248-
$this->mockPlatform = new SqlitePlatform();
248+
$this->mockPlatform = new SqlitePlatform($this->createMock(PdoDriverInterface::class));
249249
$this->mockStatement = $this->getMockBuilder(Statement::class)->getMock();
250250
$this->mockDriver = $this->getMockBuilder(Pdo::class)
251251
->setConstructorArgs([

test/unit/Platform/SqliteTest.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,9 @@ final class SqliteTest extends TestCase
4040
#[Override]
4141
protected function setUp(): void
4242
{
43-
$this->platform = new Sqlite();
43+
$this->platform = new Sqlite(new PDO(
44+
dsn: "sqlite::memory:mydb.sqlite",
45+
));
4446
}
4547

4648
public function testGetName(): void
@@ -191,10 +193,9 @@ public function testCanCloseConnectionAfterQuoteValue(): void
191193
touch($filePath);
192194
}
193195

194-
$driver = new Driver(new Connection([
195-
'driver' => 'Pdo_Sqlite',
196-
'database' => ':memory',
197-
]));
196+
$driver = (new PdoDriverFactory())->__invoke(
197+
$this->createMock(ContainerInterface::class)
198+
);
198199

199200
$this->platform->setDriver($driver);
200201
$this->platform->quoteValue("some; random]/ value");

0 commit comments

Comments
 (0)