Completed
Push — master ( 298f36...c6c82d )
by Mihail
06:19 queued 10s
created

IgbinarySerializerTest   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 12
c 0
b 0
f 0
dl 0
loc 33
rs 10
wmc 5
1
<?php
2
3
namespace Koded\Stdlib\Serializer;
4
5
use Koded\Stdlib\Interfaces\Serializer;
6
use PHPUnit\Framework\TestCase;
7
8
class IgbinarySerializerTest extends TestCase
9
{
10
11
    /** @var IgbinarySerializer */
12
    private $SUT;
13
14
    private $original;
15
    private $igb;
16
17
    public function test_serialize()
18
    {
19
        $this->assertEquals(igbinary_serialize($this->original), $this->SUT->serialize($this->original));
20
    }
21
22
    public function test_unserialize()
23
    {
24
        $this->assertEquals($this->original, $this->SUT->unserialize($this->igb));
25
    }
26
27
    public function testName()
28
    {
29
        $this->assertSame(Serializer::IGBINARY, $this->SUT->type());
30
    }
31
32
    protected function setUp(): void
33
    {
34
        if (false === function_exists('igbinary_serialize')) {
35
            $this->markTestSkipped('igbinary extension is not loaded');
36
        }
37
38
        $this->SUT = new IgbinarySerializer;
39
        $this->original = require __DIR__ . '/../fixtures/config-test.php';
40
        $this->igb = igbinary_serialize($this->original);
41
    }
42
}
43