Completed
Pull Request — master (#23)
by
unknown
01:57
created

testSerialization()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 17

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 17
rs 9.7
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace Smartbox\CoreBundle\Tests\Serializer;
4
5
use JMS\Serializer\Naming\IdenticalPropertyNamingStrategy;
6
use JMS\Serializer\SerializerBuilder;
7
use Smartbox\CoreBundle\Serializer\PlainTextDeserializationVisitor;
8
9
class PlainTextDeserializationVisitorFunctionalTest extends \PHPUnit\Framework\TestCase
10
{
11
    public function testSerialization()
12
    {
13
        $builder = new SerializerBuilder();
14
15
        $serializer = $builder
16
            ->setDeserializationVisitor(
17
                'plain_text',
18
                new PlainTextDeserializationVisitor(new IdenticalPropertyNamingStrategy())
19
            )
20
            ->build();
21
22
        $data = 'I am a silly API that returns responses in plain text';
23
24
        $result = $serializer->deserialize($data, 'string', 'plain_text');
25
26
        $this->assertSame($data, $result, 'Visitor modified the payload, it should have kept it intact.');
27
    }
28
}
29