3 * This file is part of PHPUnit.
5 * (c) Sebastian Bergmann <sebastian@phpunit.de>
7 * For the full copyright and license information, please view the LICENSE
8 * file that was distributed with this source code.
12 * @since File available since Release 3.7.0
14 class Framework_Constraint_JsonMatches_ErrorMessageProviderTest extends PHPUnit_Framework_TestCase
17 * @dataProvider translateTypeToPrefixDataprovider
18 * @covers PHPUnit_Framework_Constraint_JsonMatches_ErrorMessageProvider::translateTypeToPrefix
20 public function testTranslateTypeToPrefix($expected, $type)
24 PHPUnit_Framework_Constraint_JsonMatches_ErrorMessageProvider::translateTypeToPrefix($type)
29 * @dataProvider determineJsonErrorDataprovider
30 * @covers PHPUnit_Framework_Constraint_JsonMatches_ErrorMessageProvider::determineJsonError
32 public function testDetermineJsonError($expected, $error, $prefix)
36 PHPUnit_Framework_Constraint_JsonMatches_ErrorMessageProvider::determineJsonError(
43 public static function determineJsonErrorDataprovider()
46 'JSON_ERROR_NONE' => array(
47 null, 'json_error_none', ''
49 'JSON_ERROR_DEPTH' => array(
50 'Maximum stack depth exceeded', JSON_ERROR_DEPTH, ''
52 'prefixed JSON_ERROR_DEPTH' => array(
53 'TUX: Maximum stack depth exceeded', JSON_ERROR_DEPTH, 'TUX: '
55 'JSON_ERROR_STATE_MISMatch' => array(
56 'Underflow or the modes mismatch', JSON_ERROR_STATE_MISMATCH, ''
58 'JSON_ERROR_CTRL_CHAR' => array(
59 'Unexpected control character found', JSON_ERROR_CTRL_CHAR, ''
61 'JSON_ERROR_SYNTAX' => array(
62 'Syntax error, malformed JSON', JSON_ERROR_SYNTAX, ''
64 'JSON_ERROR_UTF8`' => array(
65 'Malformed UTF-8 characters, possibly incorrectly encoded',
69 'Invalid error indicator' => array(
70 'Unknown error', 55, ''
75 public static function translateTypeToPrefixDataprovider()
78 'expected' => array('Expected value JSON decode error - ', 'expected'),
79 'actual' => array('Actual value JSON decode error - ', 'actual'),
80 'default' => array('', ''),