Update Composer, update everything
This commit is contained in:
parent
ea3e94409f
commit
dda5c284b6
19527 changed files with 1135420 additions and 351004 deletions
60
vendor/symfony/serializer/Tests/Encoder/JsonEncodeTest.php
vendored
Normal file
60
vendor/symfony/serializer/Tests/Encoder/JsonEncodeTest.php
vendored
Normal file
|
@ -0,0 +1,60 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* 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);
|
||||
}
|
||||
}
|
Reference in a new issue