laminas / laminas-db

Database abstraction layer, SQL abstraction, result set abstraction, and RowDataGateway and TableDataGateway implementations
https://docs.laminas.dev/laminas-db/
BSD 3-Clause "New" or "Revised" License
122 stars 68 forks source link

MySQL and MSQL fixtures now recreate test structure. #222

Closed ZVanoZ closed 9 months ago

ZVanoZ commented 3 years ago
Q A
Documentation no
Bugfix no
BC Break no
New Feature no
RFC no
QA yes

Description

All time, when we run tests we need reset VirtualBox to init state. This commit recreate tested structure for MySQL and MSSQL. So, we can run tests without rollback VirtualBox image - it's spend save time.

If we run integradion test two time, we got an error

phpunit --colors=always --testsuite "integration test"
PHPUnit 9.5.10 by Sebastian Bergmann and contributors.

Integration test started.
.....FFF...................SSS..SSSS                              36 / 36 (100%)

Time: 00:03.583, Memory: 10.00 MB

There were 3 failures:

1) LaminasIntegrationTest\Db\Adapter\Driver\Pdo\Mysql\QueryTest::testQuery with data set #0 ('SELECT * FROM test WHERE id = ?', array(1), array(1, 'foo', 'bar'))
Failed asserting that two arrays are equal.
--- Expected
+++ Actual
@@ @@
 Array (
-    'id' => 1
-    'name' => 'foo'
-    'value' => 'bar'
+    'id' => '1'
+    'name' => 'bar'
+    'value' => 'foo'
 )

/app/test/integration/Adapter/Driver/Pdo/Mysql/QueryTest.php:52

2) LaminasIntegrationTest\Db\Adapter\Driver\Pdo\Mysql\QueryTest::testQuery with data set #1 ('SELECT * FROM test WHERE id = :id', array(1), array(1, 'foo', 'bar'))
Failed asserting that two arrays are equal.
--- Expected
+++ Actual
@@ @@
 Array (
-    'id' => 1
-    'name' => 'foo'
-    'value' => 'bar'
+    'id' => '1'
+    'name' => 'bar'
+    'value' => 'foo'
 )

/app/test/integration/Adapter/Driver/Pdo/Mysql/QueryTest.php:52

3) LaminasIntegrationTest\Db\Adapter\Driver\Pdo\Mysql\QueryTest::testQuery with data set #2 ('SELECT * FROM test WHERE id = :id', array(1), array(1, 'foo', 'bar'))
Failed asserting that two arrays are equal.
--- Expected
+++ Actual
@@ @@
 Array (
-    'id' => 1
-    'name' => 'foo'
-    'value' => 'bar'
+    'id' => '1'
+    'name' => 'bar'
+    'value' => 'foo'
 )

/app/test/integration/Adapter/Driver/Pdo/Mysql/QueryTest.php:52

@TODO: Do it for PostgreSQL, SQLite and other databases.