public static function setUpBeforeClass() { // remove default permissions self::$defaultPermissions = Yii::app()->db->createCommand("\n select * from x2_auth_item_child where parent='DefaultRole' and child like 'Contacts%'\n ")->queryAll(); // save them so they can be restored after test Yii::app()->db->createCommand("\n delete from x2_auth_item_child where parent='DefaultRole' and child like 'Contacts%'\n ")->execute(); // auth item insertion done instead of fixture to prevent table from being cleared Yii::app()->db->createCommand("\n insert ignore into x2_auth_item (`name`, `type`, `description`, `bizrule`, `data`) \n values ('role1', 2, '', NULL, 'N;')\n ")->execute(); Yii::app()->cache->flush(); Yii::app()->authCache->clear(); parent::setUpBeforeClass(); }
/** * Copies a test controller into the controllers directory. */ public static function setUpBeforeClass() { // ensure that a directory with the same name isn't already in the web root exec('ls ../controllers', $output); if (in_array('ProfileTestController.php', $output)) { VERBOSE_MODE && println('Warning: tests are being aborted because file ' . '"ProfileTestController" already exists in the protected/controllers'); self::$skipAllTests = true; } else { // copy over webscripts and perform replacement on URL tokens exec('cp -n webscripts/ProfileTestController.php ../controllers'); } parent::setUpBeforeClass(); }
/** * Copy over all the test pages to the web root */ public static function setUpBeforeClass() { // ensure that a directory with the same name isn't already in the web root exec('ls ../../', $output); if (TEST_BASE_URL_ALIAS_1 === '' || TEST_BASE_URL_ALIAS_2 === '' || TEST_BASE_URL_ALIAS_3 === '' || TEST_WEBROOT_URL_ALIAS_1 === '' || TEST_WEBROOT_URL_ALIAS_2 === '' || TEST_WEBROOT_URL_ALIAS_3 === '') { X2_TEST_DEBUG_LEVEL > 1 && println('Warning: tests are being aborted because the web tracking ' . 'test constants have not been properly configured.'); self::$skipAllTests = true; } else { if (in_array('x2WebTrackingTestPages', $output)) { X2_TEST_DEBUG_LEVEL > 1 && println('Warning: tests are being aborted because the directory ' . '"x2WebTrackingTestPages" already exists in the webroot'); self::$skipAllTests = true; } else { // copy over webscripts and perform replacement on URL tokens exec('cp -rn webscripts/x2WebTrackingTestPages ../../'); exec('find ../../x2WebTrackingTestPages -type f', $files); // perform URL token replacements foreach ($files as $file) { $content = file_get_contents($file); $content = preg_replace('/TEST_BASE_URL_ALIAS_1/', TEST_BASE_URL_ALIAS_1, $content); $content = preg_replace('/TEST_BASE_URL_ALIAS_2/', TEST_BASE_URL_ALIAS_2, $content); $content = preg_replace('/TEST_BASE_URL_ALIAS_3/', TEST_BASE_URL_ALIAS_3, $content); $content = preg_replace('/TEST_WEBROOT_URL_ALIAS_1/', TEST_WEBROOT_URL_ALIAS_1, $content); $content = preg_replace('/TEST_WEBROOT_URL_ALIAS_2/', TEST_WEBROOT_URL_ALIAS_2, $content); $content = preg_replace('/TEST_WEBROOT_URL_ALIAS_3/', TEST_WEBROOT_URL_ALIAS_3, $content); file_put_contents($file, $content); } } } parent::setUpBeforeClass(); }
public static function setUpBeforeClass() { Yii::app()->db->createCommand("\n insert ignore into x2_auth_item_child (`parent`, `child`) values \n ('DefaultRole', 'ReportsReadOnlyAccess'),\n ('DefaultRole', 'GroupsBasicAccess'),\n ('DefaultRole', 'GroupsUpdateAccess'),\n ('DefaultRole', 'GroupsFullAccess');\n ")->execute(); Yii::app()->authCache->clear(); return parent::setUpBeforeClass(); }