Completed
Push — master ( 2e5350...f0c5b4 )
by Tobias
10:07
created

ExposeTest::testDeserialize()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 8
Ratio 100 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 8
loc 8
rs 9.4285
cc 1
eloc 5
nc 1
nop 0
1
<?php
2
3
namespace Happyr\SerializerBundle\Tests\Functional;
4
5
use Happyr\SerializerBundle\Tests\Fixtures\Expose\Car;
6
7
class ExposeTest extends SerializerTestCase
8
{
9
    public function testSerialize()
10
    {
11
        $data = $this->serialize(new Car(true));
12
13
        $this->assertTrue(isset($data['model']));
14
        $this->assertFalse(isset($data['size']));
15
    }
16
17
    public function testDeserialize()
18
    {
19
        $data = ['model' => 'model_value', 'size' => 'size_value'];
20
        $obj = $this->deserialize($data, Car::class);
21
22
        $this->assertPropertyValue($obj, 'model', 'model_value');
23
        $this->assertPropertyValue($obj, 'size', null);
24
    }
25
}
26