| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * Generate files used during testing. |
| 5 | */ |
| 6 | class CRM_Core_CodeGen_Test extends CRM_Core_CodeGen_BaseTask { |
| 7 | |
| 8 | public function run() { |
| 9 | $this->generateCiviTestTruncate(); |
| 10 | } |
| 11 | |
| 12 | public function generateCiviTestTruncate() { |
| 13 | echo "Generating tests truncate file\n"; |
| 14 | |
| 15 | # TODO template |
| 16 | $truncate = '<?xml version="1.0" encoding="UTF-8" ?> |
| 17 | <!-- Truncate all tables that will be used in the tests --> |
| 18 | <dataset>'; |
| 19 | $tbls = array_keys($this->tables); |
| 20 | foreach ($tbls as $d => $t) { |
| 21 | $truncate = $truncate . "\n <$t />\n"; |
| 22 | } |
| 23 | |
| 24 | $truncate = $truncate . "</dataset>\n"; |
| 25 | file_put_contents($this->config->sqlCodePath . "../tests/phpunit/CiviTest/truncate.xml", $truncate); |
| 26 | unset($truncate); |
| 27 | } |
| 28 | |
| 29 | } |