sebastianbergmann / dbunit

DbUnit port for PHP/PHPUnit.
https://phpunit.de/
Other
225 stars 186 forks source link

assertTablesEqual() on an empty YAML generated table #207

Closed ernst-at-colourbox closed 6 years ago

ernst-at-colourbox commented 6 years ago

This worked fine in 3.0.2 but is broken in 3.0.3, we're using phpunit 6.2.4 on PHP 7.0.22-0

We have an empty table in a YAML file "media_group_download-seed.yml"

revolution.media_group_download:

We're doing some tests and then at the end we'd like to assert that the table is still empty "test.php"

$queryTable = $this->getConnection('revolution')->createQueryTable(
    'revolution.media_group_download',
    'SELECT medias_groups_junction_id, user_id, company_id, supplier_id  FROM revolution.media_group_download'
);

$expectedDataset = new \PHPUnit\DbUnit\DataSet\YamlDataSet(
    __DIR__ . '/fixture/media_group_download-seed.yml'
);
$expectedTable = $expectedDataset->getTable("revolution.media_group_download");

$this->assertTablesEqual($expectedTable, $queryTable);

As mentioned above up until version 3.0.2 it worked fine, but now the test fails with the output:

Failed asserting that
+----------------------+----------------------+----------------------+----------------------+----------------------+----------------------+----------------------+----------------------+----------------------+----------------------+----------------------+----------------------+----------------------+
| revolution.media_group_download                                                                                                                                                                                                                                                                          |
+----------------------+----------------------+----------------------+----------------------+----------------------+----------------------+----------------------+----------------------+----------------------+----------------------+----------------------+----------------------+----------------------+
|          id          | medias_groups_juncti |         time         |       user_id        |      company_id      |     supplier_id      |      license_id      |      downloads       |  project_reference   |       comment        |      education       |         year         |        month         |
+----------------------+----------------------+----------------------+----------------------+----------------------+----------------------+----------------------+----------------------+----------------------+----------------------+----------------------+----------------------+----------------------+

 is equal to expected
+----------------------+
| revolution.media_group_download |
+----------------------+
stale[bot] commented 6 years ago

This issue has been automatically marked as stale because it has not had activity within the last 60 days. It will be closed after 7 days if no further activity occurs. Thank you for your contributions.

arogachev commented 6 years ago

I am having the same issue. @ernst-at-colourbox, have you managed to find a workaround?

stale[bot] commented 6 years ago

This issue has been automatically marked as stale because it has not had activity within the last 60 days. It will be closed after 7 days if no further activity occurs. Thank you for your contributions.

stale[bot] commented 6 years ago

This issue has been automatically closed because it has not had activity since it was marked as stale. Thank you for your contributions.

kienanstewart commented 6 years ago

I've run into the same issue as well. Is the previous functionality (described by @ernst-at-colourbox in versions prior to 3.0.1) intended, or should tests or datasets be written differently now?

Edit: the stale bot is maybe a bit aggressive here?