PhpSerializerTest   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 8
c 1
b 0
f 0
dl 0
loc 19
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A dataProviderSerialize() 0 6 1
A testSerialize() 0 6 1
1
<?php
2
namespace RazonYang\TokenBucket\Tests;
3
4
use RazonYang\TokenBucket\Serializer\PhpSerializer;
5
6
class PhpSerializerTest extends TestCase
7
{
8
    /**
9
     * @dataProvider dataProviderSerialize
10
     */
11
    public function testSerialize($data): void
12
    {
13
        $serializer = new PhpSerializer();
14
        $value = $serializer->serialize($data);
15
        $this->assertEquals(serialize($data), $value);
16
        $this->assertEquals(unserialize($value), $serializer->unserialize($value));
17
    }
18
19
    public function dataProviderSerialize(): array
20
    {
21
        return [
22
            [1],
23
            ['foo'],
24
            [['bar']],
25
        ];
26
    }
27
}
28