sebastianbergmann / dbunit

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

Added Undefined offset test for reading XmlDataSet #122

Closed Sicaine closed 10 years ago

Sicaine commented 10 years ago

If you define n columns and add n + 1 rows it will generate an undefined offset error.

Example .xml file:

<?xml version="1.0" encoding="UTF-8"?>

id 1 1

Therefore a check is necessary. Because $rowElement->children()->count() didn't work for me properly it was necessary to test the index in the foreach instead of testing it beforehand with something like 'if ($rowElement->children()->count() >= count($tableInstanceColumns) {}

Sicaine commented 10 years ago

I changed it in the second commit. Is that patch okay or do i need to do anything else?

It was quit strange to figure out how to fix a patch.

elazar commented 10 years ago

Merged. Thanks!