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 ( 4471cd...dae846 )
by Baptiste
03:11
created

testFlagStructureAsMutableWhenUnderlyingSetValuesAreMutable()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 14
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 9
c 1
b 0
f 0
nc 2
nop 0
dl 0
loc 14
rs 9.9666
1
<?php
2
declare(strict_types = 1);
3
4
namespace Tests\Innmind\Immutable\Fixtures;
5
6
use Innmind\Immutable\Set as Structure;
7
use Innmind\BlackBox\Set as DataSet;
8
use Fixtures\Innmind\Immutable\Set;
9
use PHPUnit\Framework\TestCase;
10
11
class SetTest extends TestCase
12
{
13
    public function testInterface()
14
    {
15
        $this->assertInstanceOf(
16
            DataSet::class,
17
            new Set('string', new DataSet\Chars)
0 ignored issues
show
Bug introduced by
The type Innmind\BlackBox\Set\Chars was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
18
        );
19
    }
20
21
    public function testOf()
22
    {
23
        $this->assertInstanceOf(
24
            Set::class,
25
            Set::of('string', new DataSet\Chars)
26
        );
27
    }
28
29
    public function testGenerates100ValuesByDefault()
30
    {
31
        $sets = new Set('string', new DataSet\Chars);
32
33
        $this->assertInstanceOf(\Generator::class, $sets->values());
34
        $this->assertCount(100, \iterator_to_array($sets->values()));
35
36
        foreach ($sets->values() as $set) {
37
            $this->assertInstanceOf(DataSet\Value::class, $set);
0 ignored issues
show
Bug introduced by
The type Innmind\BlackBox\Set\Value was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
38
            $this->assertInstanceOf(Structure::class, $set->unwrap());
39
            $this->assertSame('string', (string) $set->unwrap()->type());
40
        }
41
    }
42
43
    public function testGeneratesSequencesOfDifferentSizes()
44
    {
45
        $sets = new Set(
46
            'string',
47
            new DataSet\Chars,
48
            DataSet\Integers::between(0, 50)
0 ignored issues
show
Bug introduced by
The type Innmind\BlackBox\Set\Integers was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
49
        );
50
        $sizes = [];
51
52
        foreach ($sets->values() as $set) {
53
            $sizes[] = $set->unwrap()->size();
54
        }
55
56
        $this->assertTrue(\count(\array_unique($sizes)) > 1);
57
    }
58
59
    public function testTake()
60
    {
61
        $sets1 = new Set('string', new DataSet\Chars);
62
        $sets2 = $sets1->take(50);
63
64
        $this->assertNotSame($sets1, $sets2);
65
        $this->assertInstanceOf(Set::class, $sets2);
66
        $this->assertCount(100, \iterator_to_array($sets1->values()));
67
        $this->assertCount(50, \iterator_to_array($sets2->values()));
68
    }
69
70
    public function testFilter()
71
    {
72
        $sets = new Set('string', new DataSet\Chars);
73
74
        $this->expectException(\LogicException::class);
75
        $this->expectExceptionMessage('Set set can\'t be filtered, underlying set must be filtered beforehand');
76
77
        $sets->filter(static function($set): bool {
78
            return $set->size() % 2 === 0;
79
        });
80
    }
81
82
    public function testFlagStructureAsMutableWhenUnderlyingSetValuesAreMutable()
83
    {
84
        $sets = new Set(
85
            'object',
86
            DataSet\Decorate::mutable(
0 ignored issues
show
Bug introduced by
The type Innmind\BlackBox\Set\Decorate was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
87
                fn() => new \stdClass,
88
                new DataSet\Chars,
89
            ),
90
        );
91
92
        foreach ($sets->values() as $set) {
93
            $this->assertFalse($set->isImmutable());
94
            $this->assertNotSame($set->unwrap(), $set->unwrap());
95
            $this->assertSame($set->unwrap()->size(), $set->unwrap()->size());
96
        }
97
    }
98
}
99