sebastianbergmann / dbunit

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

ArrayDataSet: invalid initialization for mixed rows #179

Closed balland closed 5 years ago

balland commented 8 years ago

I have found out that the same list of columns should be used for all the rows even if this is not strictly needed.

The problem comes from the constructor of ArrayDataSet. The first row is used to decide which columns are available: https://github.com/sebastianbergmann/dbunit/blob/master/src/Extensions/Database/DataSet/ArrayDataSet.php#L44

It would be more user-friendly to calculate the union of all the rows keys. And if this is not possible, at least yell during the construction instead of setting silently to null all the remaining columns.

RusAlex commented 7 years ago

Also met this limitation.

At least this behavior should be documented. With "IMPORTANT" label. It was hard to realize why columns were not populated.

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.

nCrazed commented 6 years ago

The first row is used to decide which columns are available

It's worse than that, row with index 0 is used. So if you build an array via something like array_filter and forget to reset the keys, you will get no columns at all.

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.

nCrazed commented 6 years ago

@sebastianbergmann I am still happy to implement a fix for this, just need a conformation that my proposed changes would be considered correct.

stale[bot] commented 5 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 5 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.