I search for a way to load test-data to a MySQL in my phpunit
testcase. I use typo3 4.5 and want to test my pages-override and some functions in my testcase. I don't want to create all models ever and ever by hand, and would like to load a test-db and some sql-file for each test. Is this possible?
Asked
Active
Viewed 433 times
1
2 Answers
2
In the tests for our TYPO3 extensions, we run $GLOBALS['TYPO3_DB']->exec_INSERTquery()
calls with test data in setUp()
. tearDown()
makes exec_DELETEquery()
calls.
Test data get names like "unittest-FOO", so that we can delete all "unittest-%" entries when cleaning up.
Alternatively, you can use the phpunit extension for TYPO3 - it adds a column to each table that indicates if a record is a test datum or not. Cleaning up afterwards is easy then.

cweiske
- 30,033
- 14
- 133
- 194