Passed
Push — master ( 3eb4db...99d5ff )
by Kirill
03:12
created

NullMemoryTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testSaveData() 0 5 1
A testLoadData() 0 5 1
1
<?php
2
3
/**
4
 * Spiral Framework.
5
 *
6
 * @license   MIT
7
 * @author    Anton Titov (Wolfy-J)
8
 */
9
10
declare(strict_types=1);
11
12
namespace Spiral\Tests\Boot;
13
14
use PHPUnit\Framework\TestCase;
15
use Spiral\Boot\MemoryInterface;
16
use Spiral\Boot\NullMemory;
17
18
class NullMemoryTest extends TestCase
19
{
20
    public function testLoadData(): void
21
    {
22
        $memory = new NullMemory();
23
        $this->assertInstanceOf(MemoryInterface::class, $memory);
24
        $this->assertNull($memory->loadData('test'));
0 ignored issues
show
Bug introduced by
Are you sure the usage of $memory->loadData('test') targeting Spiral\Boot\NullMemory::loadData() seems to always return null.

This check looks for function or method calls that always return null and whose return value is used.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
if ($a->getObject()) {

The method getObject() can return nothing but null, so it makes no sense to use the return value.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
25
    }
26
27
    public function testSaveData(): void
28
    {
29
        $memory = new NullMemory();
30
        $this->assertInstanceOf(MemoryInterface::class, $memory);
31
        $memory->saveData('test', null);
32
    }
33
}
34