First commit
This commit is contained in:
commit
c6e2478c40
13918 changed files with 2303184 additions and 0 deletions
52
sites/all/modules/civicrm/Civi/Test/Data.php
Normal file
52
sites/all/modules/civicrm/Civi/Test/Data.php
Normal file
|
@ -0,0 +1,52 @@
|
|||
<?php
|
||||
namespace Civi\Test;
|
||||
|
||||
use RuntimeException;
|
||||
|
||||
/**
|
||||
* Class Data
|
||||
*/
|
||||
class Data {
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function populate() {
|
||||
\Civi\Test::schema()->truncateAll();
|
||||
|
||||
\Civi\Test::schema()->setStrict(FALSE);
|
||||
$sqlDir = dirname(dirname(__DIR__)) . "/sql";
|
||||
|
||||
$query2 = file_get_contents("$sqlDir/civicrm_data.mysql");
|
||||
$query3 = file_get_contents("$sqlDir/test_data.mysql");
|
||||
$query4 = file_get_contents("$sqlDir/test_data_second_domain.mysql");
|
||||
if (\Civi\Test::execute($query2) === FALSE) {
|
||||
throw new RuntimeException("Cannot load civicrm_data.mysql. Aborting.");
|
||||
}
|
||||
if (\Civi\Test::execute($query3) === FALSE) {
|
||||
throw new RuntimeException("Cannot load test_data.mysql. Aborting.");
|
||||
}
|
||||
if (\Civi\Test::execute($query4) === FALSE) {
|
||||
throw new RuntimeException("Cannot load test_data.mysql. Aborting.");
|
||||
}
|
||||
|
||||
unset($query, $query2, $query3);
|
||||
|
||||
\Civi\Test::schema()->setStrict(TRUE);
|
||||
|
||||
// Rebuild triggers
|
||||
civicrm_api('system', 'flush', array('version' => 3, 'triggers' => 1));
|
||||
|
||||
\CRM_Core_BAO_ConfigSetting::setEnabledComponents(array(
|
||||
'CiviEvent',
|
||||
'CiviContribute',
|
||||
'CiviMember',
|
||||
'CiviMail',
|
||||
'CiviReport',
|
||||
'CiviPledge',
|
||||
));
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue