You are here

public static function PHPUnit_Framework_Constraint_JsonMatches_ErrorMessageProvider::translateTypeToPrefix in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/phpunit/phpunit/src/Framework/Constraint/JsonMatches/ErrorMessageProvider.php \PHPUnit_Framework_Constraint_JsonMatches_ErrorMessageProvider::translateTypeToPrefix()

Translates a given type to a human readable message prefix.

Parameters

string $type:

Return value

string

1 call to PHPUnit_Framework_Constraint_JsonMatches_ErrorMessageProvider::translateTypeToPrefix()
Framework_Constraint_JsonMatches_ErrorMessageProviderTest::testTranslateTypeToPrefix in vendor/phpunit/phpunit/tests/Framework/Constraint/JsonMatches/ErrorMessageProviderTest.php
@dataProvider translateTypeToPrefixDataprovider @covers PHPUnit_Framework_Constraint_JsonMatches_ErrorMessageProvider::translateTypeToPrefix

File

vendor/phpunit/phpunit/src/Framework/Constraint/JsonMatches/ErrorMessageProvider.php, line 51

Class

PHPUnit_Framework_Constraint_JsonMatches_ErrorMessageProvider
Provides human readable messages for each JSON error.

Code

public static function translateTypeToPrefix($type) {
  switch (strtolower($type)) {
    case 'expected':
      $prefix = 'Expected value JSON decode error - ';
      break;
    case 'actual':
      $prefix = 'Actual value JSON decode error - ';
      break;
    default:
      $prefix = '';
      break;
  }
  return $prefix;
}