public static function PHPUnit_Util_Type::shortenedExport

Exports a value into a single-line string

The output of this method is similar to the output of PHPUnit_Util_Type::export. This method guarantees thought that the result contains now newlines.

Newlines are replaced by the visible string '\n'. Contents of arrays and objects (if any) are replaced by '...'.

Parameters

mixed $value The value to export:

integer $indentation The indentation level of the 2nd+ line:

Return value

string

See also

PHPUnit_Util_Type::export

5 calls to PHPUnit_Util_Type::shortenedExport()
PHPUnit_Framework_Comparator_Array::assertEquals in drupal/core/vendor/phpunit/phpunit/PHPUnit/Framework/Comparator/Array.php
Asserts that two values are equal.
PHPUnit_Framework_Comparator_Type::assertEquals in drupal/core/vendor/phpunit/phpunit/PHPUnit/Framework/Comparator/Type.php
Asserts that two values are equal.
PHPUnit_Framework_Constraint_IsInstanceOf::failureDescription in drupal/core/vendor/phpunit/phpunit/PHPUnit/Framework/Constraint/IsInstanceOf.php
Returns the description of the failure
PHPUnit_Framework_Constraint_IsJson::failureDescription in drupal/core/vendor/phpunit/phpunit/PHPUnit/Framework/Constraint/IsJson.php
Returns the description of the failure
Util_TypeTest::testShortenedExport in drupal/core/vendor/phpunit/phpunit/Tests/Util/TypeTest.php
@dataProvider shortenedExportProvider

File

drupal/core/vendor/phpunit/phpunit/PHPUnit/Util/Type.php, line 221

Class

PHPUnit_Util_Type
Utility class for textual type (and value) representation.

Code

public static function shortenedExport($value) {
  if (is_string($value)) {
    return self::shortenedString($value);
  }
  if (is_object($value)) {
    return sprintf('%s Object (%s)', get_class($value), count(self::toArray($value)) > 0 ? '...' : '');
  }
  if (is_array($value)) {
    return sprintf('Array (%s)', count($value) > 0 ? '...' : '');
  }
  return self::export($value);
}