Passed
Push — master ( 892005...6afd92 )
by Alexander
07:55
created

CallbackSerializerTest   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 12
c 1
b 0
f 0
dl 0
loc 27
rs 10
wmc 4
1
<?php
2
3
namespace Yiisoft\Serializer\Tests;
4
5
use Yiisoft\Serializer\CallbackSerializer;
6
use Yiisoft\Serializer\SerializerInterface;
7
8
class CallbackSerializerTest extends SerializerTest
9
{
10
    public function getSerializer(): SerializerInterface
11
    {
12
        return new CallbackSerializer('serialize', 'unserialize');
13
    }
14
15
    public function serializeProvider(): array
16
    {
17
        return $this->dataProvider();
18
    }
19
20
    public function unserializeProvider(): array
21
    {
22
        return $this->dataProvider();
23
    }
24
25
    public function dataProvider(): array
26
    {
27
        return [
28
            'int' => [1, 'i:1;',],
29
            'float' => [1.1, 'd:1.1;',],
30
            'string' => ['a', 's:1:"a";',],
31
            'null' => [null, 'N;',],
32
            'bool' => [true, 'b:1;',],
33
            'object' => [new \stdClass(), 'O:8:"stdClass":0:{}',],
34
            'array' => [[], 'a:0:{}',],
35
        ];
36
    }
37
}
38