ZF-7936: Zend_Test_PHPUnit_Db_Operation_Truncate should truncate tables in reversed order.


MySQL database contains InnoDB tables with foreign keys. In XML dataset tables are described in such order, that insertion would go along with existing DB constraints. Method "execute" in "Zend_Test_PHPUnit_Db_Operation_Truncate" class tries to truncate them in same order and fails because of DB constraints. Truncating tables in reverse order would solve the problems as dependent rows would be removed before rows they depend upon.

Changing row 61 in file "Zend/Test/PHPUnit/Db/Operation/Truncate.php" to

foreach ($dataSet->getReverseIterator() as $table)

solved the problem. This applies to Zend Framework release 1.9.3PL1.


Assigning to Ben Eberlei

I patched this in trunk already, however it seems the test for it fail on 1.9 release branch, because of some missing bug i forgot to merge into 1.9 from zend test dbadapter. I do the merge into 1.9 later and then close the bug

Merged into 1.9 release branch, tests now pass