protected function PHPUnit_Framework_TestCase::runTest

Override to run the test and assert its state.

Return value

mixed

Throws

PHPUnit_Framework_Exception

1 call to PHPUnit_Framework_TestCase::runTest()
PHPUnit_Framework_TestCase::runBare in drupal/core/vendor/phpunit/phpunit/PHPUnit/Framework/TestCase.php
Runs the bare test sequence.
5 methods override PHPUnit_Framework_TestCase::runTest()
Error::runTest in drupal/core/vendor/phpunit/phpunit/Tests/_files/Error.php
Override to run the test and assert its state.
Failure::runTest in drupal/core/vendor/phpunit/phpunit/Tests/_files/Failure.php
Override to run the test and assert its state.
PHPUnit_Framework_Warning::runTest in drupal/core/vendor/phpunit/phpunit/PHPUnit/Framework/Warning.php
Success::runTest in drupal/core/vendor/phpunit/phpunit/Tests/_files/Success.php
Override to run the test and assert its state.
WasRun::runTest in drupal/core/vendor/phpunit/phpunit/Tests/_files/WasRun.php
Override to run the test and assert its state.

File

drupal/core/vendor/phpunit/phpunit/PHPUnit/Framework/TestCase.php, line 956

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 (Exception $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 ($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;
}