Passed
Push — master ( c4a808...c45372 )
by Gabriel
15:08
created

SerializableTest::test_serialize()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 13
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 2
Metric Value
eloc 9
c 2
b 0
f 2
dl 0
loc 13
rs 9.9666
cc 1
nc 1
nop 0
1
<?php
2
3
namespace ByTIC\Models\SmartProperties\Tests\Definitions\Traits;
4
5
use ByTIC\Models\SmartProperties\Properties\Definitions\Definition;
6
use ByTIC\Models\SmartProperties\Tests\AbstractTest;
7
8
/**
9
 * Class SerializableTest
10
 * @package ByTIC\Models\SmartProperties\Tests\Definitions\Traits
11
 */
12
class SerializableTest extends AbstractTest
13
{
14
    public function test_serialize()
15
    {
16
        $definition = new Definition();
0 ignored issues
show
Deprecated Code introduced by
The class ByTIC\Models\SmartProper...\Definitions\Definition has been deprecated: use \ByTIC\Models\SmartProperties\Definitions\Definition ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

16
        $definition = /** @scrutinizer ignore-deprecated */ new Definition();
Loading history...
17
        $definition->setField('status');
18
        $definition->setPlaces(['pending', 'published']);
19
        $data = serialize($definition);
20
21
        self::assertSame(
22
            'C:62:"ByTIC\Models\SmartProperties\Properties\Definitions\Definition":115:{a:4:{s:4:"name";N;s:5:"field";s:6:"status";s:5:"label";N;s:6:"places";a:2:{i:0;s:7:"pending";i:1;s:9:"published";}}}',
23
            $data
24
        );
25
        $definition2 = unserialize($data);
26
        self::assertEquals($definition, $definition2);
27
    }
28
29
}
30