public function setUp() { $this->useErrorHandler = true; // $this->setExpectedException('Exception'); parent::setUp(); set_exception_handler(array($this, 'excHandler')); }
public static function tearDownAfterClass() { if (X2_TEST_DEBUG_LEVEL > 0) { println(""); } parent::tearDownAfterClass(); }
public function __construct() { parent::__construct(); Yii::app()->reset(); $this->testDir1 = Yii::app()->getRuntimePath() . '/CDirectoryCacheDependencyTest_temp1'; @mkdir($this->testDir1); $this->testDir2 = Yii::app()->getRuntimePath() . '/CDirectoryCacheDependencyTest_temp2'; }
public function setUp() { parent::setUp(); Yii::import('application.helpers.expressions.em_core_helper', 'true'); if (!function_exists('gT')) { // Create gT function that ExpressionManager uses (but ideally should not). eval('function gT() { }'); } $this->em = new ExpressionManager(); }
public static function setUpBeforeClass() { Yii::app()->beginRequest(); Yii::app()->fixture->load(array('profile' => 'Profile', 'user' => 'User')); parent::setUpBeforeClass(); }
public function setup() { $declaredClasses = get_declared_classes(); parent::setup(); }
/** * Sets up the fixture before executing a test method. * If you override this method, make sure the parent implementation is invoked. * Otherwise, the database fixtures will not be managed properly. */ protected function setUp() { parent::setUp(); if (is_array($this->fixtures)) { $this->getFixtureManager()->load($this->fixtures); } }
public static function assertEquals($expected, $actual, $message = '', $delta = 0, $maxDepth = 10) { if ($expected instanceof \CActiveRecord) { /** @var \CActiveRecord $expected */ self::assertNotNull($actual, 'Failed asserting that two ActiveRecords are equal. Second is null. ' . $message); self::assertTrue($expected->equals($actual), 'Failed asserting that two ActiveRecords are equal. ' . $message); } elseif ($actual instanceof \CActiveRecord) { /** @var \CActiveRecord $actual */ self::assertNotNull($expected, 'Failed asserting that two ActiveRecords are equal. First is null. ' . $message); self::assertTrue($actual->equals($expected), 'Failed asserting that two ActiveRecords are equal. ' . $message); } else { parent::assertEquals($expected, $actual, $message, $delta, $maxDepth); } }
/** * Uses imap to assert that an email with the specified subject is present in the specified * mailbox * @param CTestCase $owner * @param Credentials $credentials * @param string $subject unique email subject * @param int $tries number of imap request attempts */ public function assertEmailReceived($owner, Credentials $credentials, $subject, $tries = 1) { Yii::import('application.tests.components.EmailTestingUtil'); $emailTestUtil = new EmailTestingUtil(); $emailTestUtil->credentials = $credentials; $owner->assertTrue($emailTestUtil->open()); $stream = $emailTestUtil->getStream(); $searchString = 'SUBJECT "' . $subject . '"'; for ($i = 0; $i < $tries; $i++) { $uids = imap_search($stream, $searchString, SE_UID); if ($uids) { break; } sleep(3); } $owner->assertTrue(is_array($uids)); $owner->assertEquals(1, count($uids)); $emailTestUtil->close(); }
public function tearDown() { parent::tearDown(); Yii::app()->language = null; // reset language to not affect other tests }
public static function tearDownAfterClass() { if (X2_TEST_DEBUG_LEVEL > 0) { $timer = TestingAuxLib::getClassTimer(); TestingAuxLib::log("time elapsed for test class: {$timer->stop()->getTime()}"); } parent::tearDownAfterClass(); }
public static function tearDownAfterClass() { AppFileUtil::$alwaysCurl = self::$_appFileUtilState['alwaysCurl']; AppFileUtil::$neverCurl = self::$_appFileUtilState['neverCurl']; return parent::tearDownAfterClass(); }
/** * Extension to the original {@link fail()} method which will add all data * in the buffer to the fail text. * * @param string $text * @since 0.1.0 */ public static function fail($text) { $data = static::endBuffering(); if ($data) { $text .= PHP_EOL . PHP_EOL . $data; } parent::fail($text); }
function tearDown() { Yii::app()->mongodb->drop(); parent::tearDown(); }
public function setUp() { // Load our test messages $this->msgs = (require dirname(__FILE__) . '/../fixtures/AfeedbackNotifications.php'); parent::setUp(); }
/** * Sets up before each test method runs. * This mainly sets the base URL for the test application. */ protected function setUp() { parent::setUp(); }
public function setUp() { parent::setUp(); $this->wkhtmltopdf = Yii::app()->params['wkhtmltopdf_path']; }