Closed gknapp closed 9 years ago
I guess my first question is, should dbunit create my schema from MySQL dump XML files? If not, that's where I'm going wrong.
DbUnit does not create your schema, per the documentation:
PHPUnit assumes that the database schema with all its tables, triggers, sequences and views is created before a test is run. This means you as developer have to make sure that the database is correctly setup before running the suite.
I missed that thanks.
I create my table if it doesn't exist changed my fixture to insert a row of data instead of creating the table. Works now.
Hi,
I guess my first question is, should dbunit create my schema from MySQL dump XML files? If not, that's where I'm going wrong. Otherwise ...
One of my DB tests verifies my application does the correct thing on index collision, attempts an update.
My starting state is an empty table, and my test is to insert the same row twice to see that duplicate keys are handled correctly (second insert should insert perform a merge update).
I've dumped my table structure using
mysqldump --xml
but the fixture file is purely structural.As there is no
database/table_data
I think$tableValues
may be empty, causing this error?https://github.com/sebastianbergmann/dbunit/blob/master/PHPUnit/Extensions/Database/DataSet/MysqlXmlDataSet.php#L24 https://github.com/sebastianbergmann/dbunit/blob/master/PHPUnit/Extensions/Database/DataSet/AbstractXmlDataSet.php#L60
Fixture file:
Thanks in advance.