0

I'm trying to upgrade our unit tests from PHPUnit 5.7 to 6.4. The major revision changed the autoloading of classes and I've been going around updating my base test classes to use the new ones.

We use the implementation of the ArrayDataSet found here:

https://phpunit.de/manual/current/en/database.html (about halfway down, you can search for "MyApp_DbUnit_ArrayDataSet" to get to the correct section).

The documentation still references classes for this purpose using the old style auto loading (e.g. PHPUnit_Extensions_Database_DataSet_AbstractDataSet), which no longer exist. And I'm not finding these classes anywhere, specifically:

PHPUnit_Extensions_Database_DataSet_AbstractDataSet PHPUnit_Extensions_Database_DataSet_DefaultTableMetaData PHPUnit_Extensions_Database_DataSet_DefaultTable PHPUnit_Extensions_Database_DataSet_DefaultTableIterator

It would seem the entire Extensions portion of 6.4 seems to be missing. Am I missing something?

edit I should mention that I'm using the 6.4 phar

1 Answers1

2

After some serious digging, I found:

https://github.com/sebastianbergmann/dbunit

The phar for the missing extensions can be found in the main readme there. Downloading that phar into my project and updating the phpunit config xml with an extensionsDirectory="path/to/dbunit/dir" gave me all the missing classes.

  • 2
    No serious digging would have been required if you had simply read the [ChangeLog](https://github.com/sebastianbergmann/phpunit/blob/6.0/ChangeLog-6.0.md#removed). – Sebastian Bergmann Nov 01 '17 at 04:48
  • 1
    Even after knowing what I was looking for it took me some digging to find the line that said `DbUnit is no longer bundled in the PHAR distribution of PHPUnit`. The biggest issue I had with this whole process was that the documentation for 6.4 stable regarding database testing hasn't been updated to show the new classes or mention that dbunit is no longer a part of phpunit. All I can hope for is that if someone else has an issue migrating from 5 to 6, this might help point them in the right direction. – Cole Millsap Nov 01 '17 at 12:54