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