Failed Conditions
Pull Request — master (#14)
by Chad
01:21
created

tests/Serializer/NullSerializerTest.php (1 issue)

Severity

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
namespace SubjectivePHPTest\Psr\SimpleCache\Serializer;
4
5
use SubjectivePHP\Psr\SimpleCache\Serializer\NullSerializer;
6
7
/**
8
 * @coversDefaultClass \SubjectivePHP\Psr\SimpleCache\Serializer\NullSerializer
9
 * @covers ::<private>
10
 */
11
final class NullSerializerTest extends \PHPUnit\Framework\TestCase
12
{
13
    /**
14
     * @var NullSerializer
15
     */
16
    private $serializer;
17
18
    /**
19
     * Prepare each test
20
     *
21
     * @return void
22
     */
23
    public function setUp()
24
    {
25
        $this->serializer = new NullSerializer();
26
    }
27
28
    /**
29
     * @test
30
     * @covers ::unserialize
31
     *
32
     * @return void
33
     */
34
    public function unserialize()
35
    {
36
        $data = ['foo' => 'abc', 'bar' => 123];
37
        $this->assertSame($data, $this->serializer->unserialize($data));
38
    }
39
40
    /**
41
     * @test
42
     * @covers ::serialize
43
     *
44
     * @return void
45
     */
46
    public function serialize()
47
    {
48
        $data = ['foo' => 'abc', 'bar' => 123];
49
        $serializer = new NullSerializer();
0 ignored issues
show
$serializer is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
50
        $this->assertSame($data, $this->serializer->serialize($data));
51
    }
52
}
53