public static function PHPUnit_Framework_TestFailure::exceptionToString

Returns a description for an exception.

@since Method available since Release 3.2.0

Parameters

Exception $e:

Return value

string

96 calls to PHPUnit_Framework_TestFailure::exceptionToString()
Framework_ConstraintTest::testAttributeEqualTo in drupal/core/vendor/phpunit/phpunit/Tests/Framework/ConstraintTest.php
@covers PHPUnit_Framework_Assert::attributeEqualTo @covers PHPUnit_Framework_Constraint_Attribute @covers PHPUnit_Framework_TestFailure::exceptionToString
Framework_ConstraintTest::testAttributeEqualTo2 in drupal/core/vendor/phpunit/phpunit/Tests/Framework/ConstraintTest.php
@covers PHPUnit_Framework_Assert::attributeEqualTo @covers PHPUnit_Framework_Constraint_Attribute @covers PHPUnit_Framework_TestFailure::exceptionToString
Framework_ConstraintTest::testAttributeNotEqualTo in drupal/core/vendor/phpunit/phpunit/Tests/Framework/ConstraintTest.php
@covers PHPUnit_Framework_Assert::attributeEqualTo @covers PHPUnit_Framework_Assert::logicalNot @covers PHPUnit_Framework_Constraint_Attribute @covers PHPUnit_Framework_Constraint_Not @covers PHPUnit_Framework_TestFailure::exceptionToString
Framework_ConstraintTest::testAttributeNotEqualTo2 in drupal/core/vendor/phpunit/phpunit/Tests/Framework/ConstraintTest.php
@covers PHPUnit_Framework_Assert::attributeEqualTo @covers PHPUnit_Framework_Assert::logicalNot @covers PHPUnit_Framework_Constraint_Attribute @covers PHPUnit_Framework_Constraint_Not @covers PHPUnit_Framework_TestFailure::exceptionToString
Framework_ConstraintTest::testConstraintArrayContains in drupal/core/vendor/phpunit/phpunit/Tests/Framework/ConstraintTest.php
@covers PHPUnit_Framework_Constraint_TraversableContains @covers PHPUnit_Framework_Constraint::count @covers PHPUnit_Framework_TestFailure::exceptionToString

... See full list

File

drupal/core/vendor/phpunit/phpunit/PHPUnit/Framework/TestFailure.php, line 114

Class

PHPUnit_Framework_TestFailure
A TestFailure collects a failed test together with the caught exception.

Code

public static function exceptionToString(Exception $e) {
  if ($e instanceof PHPUnit_Framework_SelfDescribing) {
    $buffer = $e
      ->toString();
    if ($e instanceof PHPUnit_Framework_ExpectationFailedException && $e
      ->getComparisonFailure()) {
      $buffer = $buffer . "\n" . $e
        ->getComparisonFailure()
        ->getDiff();
    }
    if (!empty($buffer)) {
      $buffer = trim($buffer) . "\n";
    }
  }
  else {
    if ($e instanceof PHPUnit_Framework_Error) {
      $buffer = $e
        ->getMessage() . "\n";
    }
    else {
      $buffer = get_class($e) . ': ' . $e
        ->getMessage() . "\n";
    }
  }
  return $buffer;
}