Skip to content
This repository was archived by the owner on Apr 12, 2018. It is now read-only.

PHPUnit_Extensions_Database_DataSet_CompositeDataSet() requires an array argument. #184

Closed
denilsonsa opened this issue Apr 1, 2014 · 6 comments
Assignees

Comments

@denilsonsa
Copy link

http://phpunit.de/manual/current/en/database.html#database.composite-dataset

The documentation example calls PHPUnit_Extensions_Database_DataSet_CompositeDataSet() with no arguments, but it is wrong. It should be called with an array().

Which is the meaning of that array? Also undocumented.

I only know that an empty array works because of http://someguyjeremy.com/blog/database-testing-with-phpunit

(footnote: actually, it doesn't work, it complains about InvalidArgumentException: DataSet contains a table that already exists: foobar)

@elazar
Copy link
Collaborator

elazar commented Apr 1, 2014

Are you using DbUnit 1.3.1? I believe this issue was addressed in that release.

@denilsonsa
Copy link
Author

Commit 89139eaa168e0cdfd9c2ee4bae2e7d5fb5e58c76 makes that constructor parameter optional, and indeed it was released last week.

Thanks! (but the documentation is still lacking)

@elazar
Copy link
Collaborator

elazar commented Apr 1, 2014

Can you provide specifics on why the documentation is lacking? There's an example of CompositeDataSet usage near the bottom of this manual section:

<?php
class CompositeTest extends PHPUnit_Extensions_Database_TestCase
{
    public function getDataSet()
    {
        $ds1 = $this->createFlatXmlDataSet('fixture1.xml');
        $ds2 = $this->createFlatXmlDataSet('fixture2.xml');

        $compositeDs = new PHPUnit_Extensions_Database_DataSet_CompositeDataSet();
        $compositeDs->addDataSet($ds1);
        $compositeDs->addDataSet($ds2);

        return $compositeDs;
    }
}
?>

@denilsonsa
Copy link
Author

Lacking the description of the (optional) parameter from the constructor.

(sorry for my tone, I guess I was a bit too angry, I should have calmed down and posted a more helpful issue)

@elazar
Copy link
Collaborator

elazar commented Apr 1, 2014

No worries, just trying to get as much information as I can while the apparently painful memory is still fresh. ;) We'll try to get this addressed. Thanks for the issue report!

@sebastianbergmann
Copy link
Owner

Dear contributor,

thanks to the hard work by @belanur, @starikovm, @trueromio, and others, the changes outlined in #471 (comment) have been implemented.

This repository, https://github.com/sebastianbergmann/phpunit-documentation, is now archived and read-only. The documentation for PHPUnit version prior to PHPUnit 7.0 will no longer be changed or updated. It is still hosted at

  • Multiple HTML files: https://phpunit.de/manual/6.5/en/index.html
  • Multiple HTML files (in a .tar.bz2 archive): https://phpunit.de/manual/current/en/download.tar.bz2
  • Single HTML file: https://phpunit.de/manual/current/en/phpunit-book.html
  • PDF: https://phpunit.de/manual/current/en/phpunit-book.pdf
  • ePub: https://phpunit.de/manual/current/en/phpunit-book.epub

Simply replace 6.5 with the version number you are looking for. Simply replace en with fr, pt_br, ja, or zh_cn to access the French, Brazilian Portuguese, Japanese, or Simplified Chinese translation, respectively.

Starting with the documentation for PHPUnit 7.0, the PHPUnit documentation is hosted at https://phpunit.readthedocs.io/.

I am sorry that I have to close this issue here as GitHub does not support moving issues from one project to another. Please open a new ticket for this issue in one of the new issue trackers (see above).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants