コード例 #1
0
 public function setUp()
 {
     // default onlineOnly value
     Yii::app()->settings->onlineOnly = 0;
     //$this->assertSaves (Yii::app()->settings);
     parent::setUp();
 }
コード例 #2
0
ファイル: AdminTest.php プロジェクト: dsyman2/X2CRM
 public static function tearDownAfterClass()
 {
     AppFileUtil::$alwaysCurl = self::$_appFileUtilState['alwaysCurl'];
     AppFileUtil::$neverCurl = self::$_appFileUtilState['neverCurl'];
     Yii::app()->settings->unique_id = self::$_adminState['unique_id'];
     Yii::app()->settings->save();
     return parent::tearDownAfterClass();
 }
コード例 #3
0
 public static function setUpBeforeClass()
 {
     // must be set to true so that the command uses the test database
     if (!YII_UNIT_TESTING || !YII_DEBUG) {
         self::$skipAllTests = true;
     }
     parent::setUpBeforeClass();
 }
コード例 #4
0
ファイル: X2FlowTestingAuxLib.php プロジェクト: keyeMyria/CRM
 /**
  * Clears all trigger logs
  */
 public static function clearLogs(X2DbTestCase $that = null)
 {
     Yii::app()->db->createCommand('delete from x2_trigger_logs where 1=1')->execute();
     $count = Yii::app()->db->createCommand('select count(*) from x2_trigger_logs
          where 1=1')->queryScalar();
     if ($that) {
         $that->assertTrue($count === '0');
     }
 }
コード例 #5
0
ファイル: X2ModelTest.php プロジェクト: tymiles003/X2CRM
 public function tearDown()
 {
     $this->resetNameFields();
     parent::tearDown();
 }
コード例 #6
0
ファイル: UpdaterBehaviorTest.php プロジェクト: keyeMyria/CRM
 public static function tearDownAfterClass()
 {
     X2DbTestCase::tearDownAppEnvironment();
     return parent::tearDownAfterClass();
 }
コード例 #7
0
 public function tearDown()
 {
     self::restoreIniSettings();
     return parent::tearDown();
 }
コード例 #8
0
ファイル: X2DbTestCase.php プロジェクト: shuvro35/X2CRM
 public function tearDown()
 {
     // try to replace mocks with original components in case mocks were set during test case
     TestingAuxLib::restoreX2WebUser();
     TestingAuxLib::restoreX2AuthManager();
     TestingAuxLib::restoreController();
     self::$skipAllTests = false;
     self::$loadFixtures = X2_LOAD_FIXTURES;
     self::$loadFixturesForClassOnly = X2_LOAD_FIXTURES_FOR_CLASS_ONLY;
     if (isset($this->_oldSession)) {
         $_SESSION = $this->_oldSession;
     }
     return parent::tearDown();
 }
コード例 #9
0
ファイル: FieldFormatterTest.php プロジェクト: keyeMyria/CRM
 /**
  * Clean up custom field columns 
  */
 public static function tearDownAfterClass()
 {
     $fields = Fields::model()->findAllByAttributes(array('custom' => 1));
     foreach ($fields as $field) {
         assert($field->delete());
     }
     Yii::app()->db->schema->refresh();
     Yii::app()->cache->flush();
     Contacts::model()->refreshMetaData();
     Contacts::model()->resetFieldsPropertyCache();
     AuxLib::debugLogR('Contacts::model ()->getAttributes () = ');
     AuxLib::debugLogR(Contacts::model()->getAttributes());
     parent::tearDownAfterClass();
 }
コード例 #10
0
ファイル: X2WebTestCase.php プロジェクト: tymiles003/X2CRM
 /**
  * Sets up before each test method runs.
  * 
  * This mainly sets the base URL for the test application, and sets the 
  * Selenese path to make it easier to locate/use Selenese HTML scripts.
  */
 public function setUp()
 {
     if (X2_TEST_DEBUG_LEVEL > 1) {
         /**/
         println("\nrunning test case: " . $this->getName());
     }
     if (X2_SKIP_ALL_TESTS || self::$skipAllTests) {
         $this->markTestSkipped();
     }
     if (self::$loadFixturesForClassOnly) {
         $this->getFixtureManager()->loadFixtures = true;
     }
     $fixtures = is_array($this->fixtures) ? $this->fixtures : array();
     $this->fixtures = array_merge($fixtures, static::referenceFixtures());
     if (X2_TEST_DEBUG_LEVEL > 1) {
         println(' ' . $this->getName());
     }
     X2DbTestCase::setUpAppEnvironment(true);
     if (isset($_SESSION)) {
         $this->_oldSession = $_SESSION;
     }
     parent::setUp();
     $this->setSeleneseDir();
     // Set the screenshot path to one visible from the web.
     //$this->screenshotPath = Yii::app()->basePath . implode(DIRECTORY_SEPARATOR, array('', '..', 'uploads', 'testing'));
     //$this->screenshotUrl = rtrim(TEST_BASE_URL, 'index-test.php') . 'uploads/testing';
     $this->setBrowserUrl(TEST_BASE_URL);
     $this->prepareTestSession();
     if ($this->autoLogin) {
         $this->openX2('/site/login');
         $this->session();
     }
 }
コード例 #11
0
ファイル: DocsTest.php プロジェクト: keyeMyria/CRM
 public static function tearDownAfterClass()
 {
     Yii::app()->db->createCommand("\n            update x2_modules set title=:title where name='quotes'\n        ")->execute(array(':title' => 'Quotes'));
     Yii::app()->db->createCommand("\n            update x2_modules set title=:title where name='contacts'\n        ")->execute(array(':title' => 'Contacts'));
     parent::tearDownAfterClass();
 }
コード例 #12
0
ファイル: EventsTest.php プロジェクト: dsyman2/X2CRM
 public function tearDown()
 {
     Yii::app()->settings->historyPrivacy = null;
     return parent::tearDown();
 }
コード例 #13
0
ファイル: X2DbTestCase.php プロジェクト: shayanyi/CRM
 /**
  * Loads "reference fixtures" defined in {@link referenceFixtures()} and
  * sets up some special environment variables before proceeding.
  */
 public static function setUpBeforeClass()
 {
     if (!YII_UNIT_TESTING) {
         throw new CException('YII_UNIT_TESTING must be set to true');
     }
     Yii::app()->cache->flush();
     self::setUpAppEnvironment();
     // Load "reference fixtures", needed for reference, which do not need
     // to be reloaded after every single test method:
     $testClass = get_called_class();
     $refFix = call_user_func("{$testClass}::referenceFixtures");
     $fm = Yii::app()->getComponent('fixture');
     self::$_referenceFixtureRows = array();
     self::$_referenceFixtureRecords = array();
     if (is_array($refFix)) {
         Yii::import('application.components.X2Settings.*');
         $fm->load($refFix);
         if (self::$loadFixtures || self::$loadFixturesForClassOnly) {
             foreach ($refFix as $alias => $table) {
                 $tableName = is_array($table) ? $table[0] : $table;
                 self::$_referenceFixtureRows[$alias] = $fm->getRows($alias);
                 if (strpos($tableName, ':') !== 0) {
                     foreach (self::$_referenceFixtureRows[$alias] as $rowAlias => $row) {
                         $model = CActiveRecord::model($tableName);
                         $key = $model->getTableSchema()->primaryKey;
                         if (is_string($key)) {
                             $pk = $row[$key];
                         } else {
                             foreach ($key as $k) {
                                 $pk[$k] = $row[$k];
                             }
                         }
                         self::$_referenceFixtureRecords[$alias][$rowAlias] = $model->findByPk($pk);
                     }
                 }
             }
         }
     }
     self::setUpAppEnvironment2();
     parent::setUpBeforeClass();
 }
コード例 #14
0
ファイル: X2FlowTestBase.php プロジェクト: tymiles003/X2CRM
 public static function tearDownAfterClass()
 {
     X2FlowTestingAuxLib::clearLogs();
     parent::tearDownAfterClass();
 }
コード例 #15
0
ファイル: X2DbTestCase.php プロジェクト: dsyman2/X2CRM
 public function tearDown()
 {
     // try to replace mocks with original components in case mocks were set during test case
     TestingAuxLib::restoreX2WebUser();
     TestingAuxLib::restoreX2AuthManager();
     TestingAuxLib::restoreController();
     self::$skipAllTests = false;
     self::$loadFixtures = X2_LOAD_FIXTURES;
     self::$loadFixturesForClassOnly = X2_LOAD_FIXTURES_FOR_CLASS_ONLY;
     if (isset($this->_oldSession)) {
         $_SESSION = $this->_oldSession;
     }
     if (X2_TEST_DEBUG_LEVEL > 0) {
         $timer = TestingAuxLib::getCaseTimer();
         TestingAuxLib::log("time elapsed for test case: {$timer->stop()->getTime()}");
     }
     return parent::tearDown();
 }
コード例 #16
0
 public static function tearDownAfterClass()
 {
     self::restoreFields();
     return parent::tearDownAfterClass();
 }
コード例 #17
0
ファイル: X2WebTestCase.php プロジェクト: keyeMyria/CRM
 /**
  * Sets up before each test method runs.
  * 
  * This mainly sets the base URL for the test application, and sets the 
  * Selenese path to make it easier to locate/use Selenese HTML scripts.
  */
 protected function setUp()
 {
     if (self::$skipAllTests) {
         $this->markTestSkipped();
     }
     if (self::$loadFixturesForClassOnly) {
         $this->getFixtureManager()->loadFixtures = true;
     }
     // print out test name
     VERBOSE_MODE && println("\n" . $this->getName());
     X2DbTestCase::setUpAppEnvironment(true);
     parent::setUp();
     $this->setSeleneseDir();
     // Set the screenshot path to one visible from the web.
     //$this->screenshotPath = Yii::app()->basePath . implode(DIRECTORY_SEPARATOR, array('', '..', 'uploads', 'testing'));
     //$this->screenshotUrl = rtrim(TEST_BASE_URL, 'index-test.php') . 'uploads/testing';
     $this->setBrowserUrl(TEST_BASE_URL);
     $this->prepareTestSession();
     if ($this->autoLogin) {
         $this->openX2('/site/login');
         $this->session();
     }
 }