* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Serializer\Tests\Encoder; use PHPUnit\Framework\TestCase; use Symfony\Component\Serializer\Encoder\JsonEncode; use Symfony\Component\Serializer\Encoder\JsonEncoder; class JsonEncodeTest extends TestCase { private $encoder; protected function setUp() { $this->encode = new JsonEncode(); } public function testSupportsEncoding() { $this->assertTrue($this->encode->supportsEncoding(JsonEncoder::FORMAT)); $this->assertFalse($this->encode->supportsEncoding('foobar')); } /** * @dataProvider encodeProvider */ public function testEncode($toEncode, $expected, $context) { $this->assertEquals( $expected, $this->encode->encode($toEncode, JsonEncoder::FORMAT, $context) ); } public function encodeProvider() { return array( array(array(), '[]', array()), array(array(), '{}', array('json_encode_options' => JSON_FORCE_OBJECT)), ); } /** * @requires function json_last_error_msg * @expectedException \Symfony\Component\Serializer\Exception\UnexpectedValueException */ public function testEncodeWithError() { $this->encode->encode("\xB1\x31", JsonEncoder::FORMAT); } } __halt_compiler();----SIGNATURE:----mb7bCOEn6oSUFIYRk5+6IP1qHjW+wggo0x/3D2MMuB8rW0/IVB1HCSWdVqyr0hWI7k6ai70FNL0DFypO+iyf8CoFPoZAJMwhpOQnJom9+6UG2Mk3oQcI/WEuro29Mn3KSnHRuk7+2ELNSMo7wchwpdtMiJJxYRRRuWmK2lkWO7W84zqNcW1YQ98MemQgR4XRw5sfvGiNuV3uet5aIKFs3l5TWnCF2jJo1Clv741ELQvUHs578VLIaRRfI73qOjobuZAM4+F2qFv7TJPkmbb0WL5gDXsFgUrDYHjWoCfivJl9u+btfAJXPlugmrQ4KEutjiKYWVm5iLpLDKdnh8s2gwSQMm9nDMHwTNklGnY4oebTRnpv3NGHW75Y8plXlebMmdExU0bzEMpzyibfHDbgeMCRXsR19zEL0yiYtTYwF9G0n4GVAG9w1lD1G2APdEyZYMWerW0BQCEvVTBI93ouGbC4r8LonLePwpvQUHyHfKjlrrBS1EXIZcmbX2vXtpZC1bepEF75XFCC7ZRNRt/bJdw62Jj7W4FdYOebaQq7VCdsByjKHvg3fs6x7Z2kcXqdtvrSaNwKFTASEsI+pl5so6HXRCxqroDTKQxWBlesd4pC8UL1H7ras9x+RdI80+3CF7O8cE6/0iWhYxWiOXPwz31yyA1xJNohHJvCJ0hYO64=----ATTACHMENT:----ODM1MjM5NTU5NjE4MTY0MyA3ODYwNDE3NDM5MjkwNzQ3IDgwNDQ0MTA2OTMxNzE3NzM=