|
@@ 12-25 (lines=14) @@
|
| 9 |
|
*/ |
| 10 |
|
class ConfiguredContextFactoryTest extends \PHPUnit_Framework_TestCase |
| 11 |
|
{ |
| 12 |
|
public function testCreateSerializationContext() |
| 13 |
|
{ |
| 14 |
|
$config = $this->getContextConfig(); |
| 15 |
|
$object = new ConfiguredContextFactory($config); |
| 16 |
|
|
| 17 |
|
$this->assertInstanceOf('JMS\Serializer\ContextFactory\SerializationContextFactoryInterface', $object); |
| 18 |
|
|
| 19 |
|
$context = $object->createSerializationContext(); |
| 20 |
|
$this->assertInstanceOf('JMS\Serializer\SerializationContext', $context); |
| 21 |
|
$this->assertSame($config['serialize_null'], $context->shouldSerializeNull()); |
| 22 |
|
|
| 23 |
|
$this->assertSame($config['version'], $context->attributes->get('version')->get()); |
| 24 |
|
$this->assertSame($config['groups'], $context->attributes->get('groups')->get()); |
| 25 |
|
} |
| 26 |
|
|
| 27 |
|
public function testCreateDeserializationContext() |
| 28 |
|
{ |
|
@@ 27-40 (lines=14) @@
|
| 24 |
|
$this->assertSame($config['groups'], $context->attributes->get('groups')->get()); |
| 25 |
|
} |
| 26 |
|
|
| 27 |
|
public function testCreateDeserializationContext() |
| 28 |
|
{ |
| 29 |
|
$config = $this->getContextConfig(); |
| 30 |
|
$object = new ConfiguredContextFactory($config); |
| 31 |
|
|
| 32 |
|
$this->assertInstanceOf('JMS\Serializer\ContextFactory\DeserializationContextFactoryInterface', $object); |
| 33 |
|
|
| 34 |
|
$context = $object->createDeserializationContext(); |
| 35 |
|
$this->assertInstanceOf('JMS\Serializer\DeserializationContext', $context); |
| 36 |
|
$this->assertSame($config['serialize_null'], $context->shouldSerializeNull()); |
| 37 |
|
|
| 38 |
|
$this->assertSame($config['version'], $context->attributes->get('version')->get()); |
| 39 |
|
$this->assertSame($config['groups'], $context->attributes->get('groups')->get()); |
| 40 |
|
} |
| 41 |
|
|
| 42 |
|
private function getContextConfig() |
| 43 |
|
{ |