JsonSerializerTest::dataProviderSerialize()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 3
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 6
rs 10
1
<?php
2
namespace RazonYang\TokenBucket\Tests;
3
4
use RazonYang\TokenBucket\Serializer\JsonSerializer;
5
6
class JsonSerializerTest extends TestCase
7
{
8
    /**
9
     * @dataProvider dataProviderSerialize
10
     */
11
    public function testSerialize($data): void
12
    {
13
        $serializer = new JsonSerializer();
14
        $value = $serializer->serialize($data);
15
        $this->assertEquals(json_encode($data), $value);
16
        $this->assertEquals($data, $serializer->unserialize($value));
17
    }
18
19
    public function dataProviderSerialize(): array
20
    {
21
        return [
22
            [1],
23
            ['foo'],
24
            [['bar']],
25
        ];
26
    }
27
}
28