9 require_once
'PU_testcase_dcp.php';
20 self::$odb->rollbackPoint(
'testunit');
25 self::$odb->savePoint(
'testunit');
30 parent::setUpBeforeClass();
33 self::beginTransaction();
35 $configList = static::appConfig();
36 if (!is_array($configList) && !empty($configList)) {
37 throw new \Exception(sprintf(
"::appConfig() did not returned an array (returned type is %s).", gettype($configList)));
40 if (isset($configList[
'appRoot']) || isset($configList[
'appName'])) {
45 foreach ($configList as $i => $config) {
46 if (!is_array($config) && !empty($config)) {
47 throw new \Exception(sprintf(
"::appConfig() at index %d is not an array (returned type is %s).", $i, gettype($config)));
49 if (!isset($config[
'appRoot']) || !isset($config[
'appName'])) {
50 throw new \Exception(sprintf(
"Missing 'appRoot' or 'appName'."));
53 self::setIncludePath(ini_get(
'include_path') .
':' . $config[
'appRoot']);
55 self::setUpTestApplication($config[
'appRoot'], $config[
'appName']);
57 if (isset($config[
'import'])) {
58 if (is_scalar($config[
'import'])) {
59 $config[
'import'] = array(
63 if (is_array($config[
'import'])) {
64 foreach ($config[
'import'] as
$import) {
65 self::importDocument($import);
74 self::rollbackTransaction();
75 self::resetIncludePath();
88 if (!is_dir($appRoot)) {
89 throw new \Exception(sprintf(
"appRoot '%s' is not a valid directory.", $appRoot));
92 $fileDotApp = join(DIRECTORY_SEPARATOR, array(
95 sprintf(
"%s.app", $appName)
97 if (!is_file($fileDotApp)) {
98 throw new \Exception(sprintf(
".app file '%s' not found.", $fileDotApp));
101 $myAction = self::getAction();
107 self::$app->set($appName, $myAction->parent, $myAction->parent->session,
true);
110 throw new \Exception(sprintf(
"Error initializing application from '%s'.", $fileDotApp));
static setUpBeforeClass()
static tearDownAfterClass()
static setUpTestApplication($appRoot, $appName)