protected function PHPUnit_Framework_TestCase::runTest in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/phpunit/phpunit/src/Framework/TestCase.php \PHPUnit_Framework_TestCase::runTest()
Override to run the test and assert its state.
Return value
mixed
Throws
Exception|PHPUnit_Framework_Exception
1 call to PHPUnit_Framework_TestCase::runTest()
- PHPUnit_Framework_TestCase::runBare in vendor/
phpunit/ phpunit/ src/ Framework/ TestCase.php - Runs the bare test sequence.
9 methods override PHPUnit_Framework_TestCase::runTest()
- Failure::runTest in vendor/
phpunit/ phpunit/ tests/ _files/ Failure.php - Override to run the test and assert its state.
- PHPUnit_Framework_IncompleteTestCase::runTest in vendor/
phpunit/ phpunit/ src/ Framework/ IncompleteTestCase.php - PHPUnit_Framework_SkippedTestCase::runTest in vendor/
phpunit/ phpunit/ src/ Framework/ SkippedTestCase.php - PHPUnit_Framework_Warning::runTest in vendor/
phpunit/ phpunit/ src/ Framework/ Warning.php - Success::runTest in vendor/
phpunit/ phpunit/ tests/ _files/ Success.php - Override to run the test and assert its state.
File
- vendor/
phpunit/ phpunit/ src/ Framework/ TestCase.php, line 870
Class
- PHPUnit_Framework_TestCase
- A TestCase defines the fixture to run multiple tests.
Code
protected function runTest() {
if ($this->name === null) {
throw new PHPUnit_Framework_Exception('PHPUnit_Framework_TestCase::$name must not be null.');
}
try {
$class = new ReflectionClass($this);
$method = $class
->getMethod($this->name);
} catch (ReflectionException $e) {
$this
->fail($e
->getMessage());
}
try {
$testResult = $method
->invokeArgs($this, array_merge($this->data, $this->dependencyInput));
} catch (Throwable $_e) {
$e = $_e;
} catch (Exception $_e) {
$e = $_e;
}
if (isset($e)) {
$checkException = false;
if (is_string($this->expectedException)) {
$checkException = true;
if ($e instanceof PHPUnit_Framework_Exception) {
$checkException = false;
}
$reflector = new ReflectionClass($this->expectedException);
if ($this->expectedException == 'PHPUnit_Framework_Exception' || $reflector
->isSubclassOf('PHPUnit_Framework_Exception')) {
$checkException = true;
}
}
if ($checkException) {
$this
->assertThat($e, new PHPUnit_Framework_Constraint_Exception($this->expectedException));
if (is_string($this->expectedExceptionMessage) && !empty($this->expectedExceptionMessage)) {
$this
->assertThat($e, new PHPUnit_Framework_Constraint_ExceptionMessage($this->expectedExceptionMessage));
}
if (is_string($this->expectedExceptionMessageRegExp) && !empty($this->expectedExceptionMessageRegExp)) {
$this
->assertThat($e, new PHPUnit_Framework_Constraint_ExceptionMessageRegExp($this->expectedExceptionMessageRegExp));
}
if ($this->expectedExceptionCode !== null) {
$this
->assertThat($e, new PHPUnit_Framework_Constraint_ExceptionCode($this->expectedExceptionCode));
}
return;
}
else {
throw $e;
}
}
if ($this->expectedException !== null) {
$this
->assertThat(null, new PHPUnit_Framework_Constraint_Exception($this->expectedException));
}
return $testResult;
}