/** * @access protected */ protected function runTest() { $timer = new Benchmark_Timer(); $timer->start(); parent::runTest(); $timer->stop(); if ($this->maxRunningTime != 0 && $timer->timeElapsed() > $this->maxRunningTime) { $this->fail(sprintf('expected running time: <= %s but was: %s', $this->maxRunningTime, $timer->timeElapsed())); } }
/** * @access protected */ protected function runTest() { try { parent::runTest(); } catch (Exception $e) { if (is_a($e, $this->expected)) { return; } else { throw $e; } } $this->fail('Expected exception ' . $this->expected); }
/** * @param string $message * @access public */ public function __construct($message = '') { $this->message = $message; parent::__construct('Warning'); }
/** * this is run before each test* function in this class, to set * up the environment each test runs in. */ public function setUp() { parent::setUp(); $this->admin_user_id = $this->factory->user->create(array('role' => 'administrator')); wp_set_current_user($this->admin_user_id); }
public function __construct($name) { parent::__construct($name); }
/** * @access protected */ protected function runTest() { try { parent::runTest(); } catch (Exception $e) { if ($this->expectedException !== NULL && $e instanceof $this->expectedException) { return; } else { throw $e; } } if ($this->expectedException !== NULL) { $this->fail('Expected exception ' . $this->expectedException); } }
protected function verifySuccess(PHPUnit2_Framework_TestCase $test) { $result = $test->run(); $this->assertEquals(0, $result->errorCount()); $this->assertEquals(0, $result->failureCount()); $this->assertEquals(1, $result->runCount()); }