sebastianbergmann / dbunit

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

Database Query Data Set returning without columns on empty table #180

Closed earllapura closed 6 years ago

earllapura commented 7 years ago

Sorry for posting on the PHPUnit site. I intended to test my delete function in a model class. I used this snippet of code:

public function testDeleteCalendar()
{
    $this->testCreateCalendar();
    $specifiers = array('title'=>'hello');
    $result = $this->calendarFactory->delete($specifiers);
    $this->assertTrue($result, "Delete Operation Failed");
    $expected = $this->createXMLDataSet('./tests/data/after_delete.xml');
    $actual = new PHPUnit_Extensions_Database_DataSet_QueryDataSet($this->getConnection());
    $actual->addTable('calendar', 'SELECT * FROM calendar');
    //assert data sets are equal
    $this->assertDataSetsEqual($expected, $actual, "Changes not reflected in database");
}

The last assertion failed:

Failed asserting that
+
|    calendar
+
|
+
is equal to expected
+-----------------------------------------------------------------------------------------+
|    calendar
+-----------------------------------------------------------------------------------------+
|    id    |    title    |    description    |    ..so on...    |
+-----------------------------------------------------------------------------------------+
insert trace here

There are no columns in the data set from the database. What happened?

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.