Skip to content

Commit d2ab18e

Browse files
committed
fix sqlite
1 parent 667e688 commit d2ab18e

File tree

4 files changed

+26
-4
lines changed

4 files changed

+26
-4
lines changed

baseline.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,12 @@
9595
<code><![CDATA[archive]]></code>
9696
</UndefinedInterfaceMethod>
9797
</file>
98+
<file src="src/Schema/DoctrineHelper.php">
99+
<InternalMethod>
100+
<code><![CDATA[getParams]]></code>
101+
<code><![CDATA[getParams]]></code>
102+
</InternalMethod>
103+
</file>
98104
<file src="src/Schema/DoctrineSchemaDirector.php">
99105
<InternalMethod>
100106
<code><![CDATA[getName]]></code>

src/Schema/DoctrineHelper.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ public static function sameDatabase(Connection $connectionA, Connection $connect
2020
return true;
2121
}
2222

23+
if ($connectionA->getParams() === $connectionB->getParams()) {
24+
return true;
25+
}
26+
2327
$checkTable = 'same_db_check_' . bin2hex(random_bytes(7));
2428
$connectionA->executeStatement(sprintf('CREATE TABLE %s (id INTEGER NOT NULL)', $checkTable));
2529

tests/Unit/Store/DoctrineDbalStoreTest.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1375,9 +1375,11 @@ public function testWait(): void
13751375
$doctrineDbalStore->wait(100);
13761376
}
13771377

1378-
public function testConfigureSchemaWithDifferentConnections(): void
1378+
public function testConfigureSchemaWithDifferentDatabase(): void
13791379
{
13801380
$connection = $this->createMock(Connection::class);
1381+
$connection->expects($this->once())->method('getParams')->willReturn(['dbname' => 'db']);
1382+
13811383
$eventSerializer = $this->createMock(EventSerializer::class);
13821384
$headersSerializer = $this->createMock(HeadersSerializer::class);
13831385

@@ -1386,8 +1388,12 @@ public function testConfigureSchemaWithDifferentConnections(): void
13861388
$eventSerializer,
13871389
$headersSerializer,
13881390
);
1391+
1392+
$differentConnection = $this->createMock(Connection::class);
1393+
$differentConnection->expects($this->once())->method('getParams')->willReturn(['dbname' => 'db2']);
1394+
13891395
$schema = new Schema();
1390-
$doctrineDbalStore->configureSchema($schema, $this->createMock(Connection::class));
1396+
$doctrineDbalStore->configureSchema($schema, $differentConnection);
13911397

13921398
self::assertEquals(new Schema(), $schema);
13931399
}

tests/Unit/Store/StreamDoctrineDbalStoreTest.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1404,9 +1404,11 @@ public function testWait(): void
14041404
$doctrineDbalStore->wait(100);
14051405
}
14061406

1407-
public function testConfigureSchemaWithDifferentConnections(): void
1407+
public function testConfigureSchemaWithDifferentDatabase(): void
14081408
{
14091409
$connection = $this->createMock(Connection::class);
1410+
$connection->expects($this->once())->method('getParams')->willReturn(['dbname' => 'db']);
1411+
14101412
$eventSerializer = $this->createMock(EventSerializer::class);
14111413
$headersSerializer = $this->createMock(HeadersSerializer::class);
14121414

@@ -1415,8 +1417,12 @@ public function testConfigureSchemaWithDifferentConnections(): void
14151417
$eventSerializer,
14161418
$headersSerializer,
14171419
);
1420+
1421+
$differentConnection = $this->createMock(Connection::class);
1422+
$connection->expects($this->once())->method('getParams')->willReturn(['dbname' => 'db2']);
1423+
14181424
$schema = new Schema();
1419-
$doctrineDbalStore->configureSchema($schema, $this->createMock(Connection::class));
1425+
$doctrineDbalStore->configureSchema($schema, $differentConnection);
14201426

14211427
self::assertEquals(new Schema(), $schema);
14221428
}

0 commit comments

Comments
 (0)