GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Passed
Push — develop ( 7af216...ebf010 )
by Baptiste
13:17
created

NullableTypeTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 18
dl 0
loc 35
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A testDoesntThrowWhenValueIsNull() 0 10 1
A testUseUnderlyingTypeWhenValueIsNotNull() 0 12 1
A testInterface() 0 7 1
1
<?php
2
declare(strict_types = 1);
3
4
namespace Tests\Innmind\Immutable\ValidateArgument;
5
6
use Innmind\Immutable\{
7
    ValidateArgument\NullableType,
8
    ValidateArgument,
9
};
10
use PHPUnit\Framework\TestCase;
11
12
class NullableTypeTest extends TestCase
13
{
14
    public function testInterface()
15
    {
16
        $type = new NullableType(
17
            $this->createMock(ValidateArgument::class)
18
        );
19
20
        $this->assertInstanceOf(ValidateArgument::class, $type);
21
    }
22
23
    public function testDoesntThrowWhenValueIsNull()
24
    {
25
        $type = new NullableType(
26
            $inner = $this->createMock(ValidateArgument::class)
27
        );
28
        $inner
29
            ->expects($this->never())
30
            ->method('__invoke');
31
32
        $this->assertNull($type(null, 1));
33
    }
34
35
    public function testUseUnderlyingTypeWhenValueIsNotNull()
36
    {
37
        $type = new NullableType(
38
            $inner = $this->createMock(ValidateArgument::class)
39
        );
40
        $value = new \stdClass;
41
        $inner
42
            ->expects($this->once())
43
            ->method('__invoke')
44
            ->with($value, 1);
45
46
        $this->assertNull($type($value, 1));
47
    }
48
}
49