Passed
Push — master ( 337d8e...76e5f0 )
by Gabriel
02:33
created

ClassCollectionTest   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 4
eloc 9
c 1
b 0
f 1
dl 0
loc 32
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A typeInvalidValues() 0 3 1
A typeClass() 0 3 1
A typeValidValues() 0 3 1
A newCollection() 0 5 1
1
<?php
2
3
namespace Nip\Collections\Tests\Typed;
4
5
use Nip\Collections\Tests\AbstractTest;
6
use Nip\Collections\Tests\Fixtures\BaseObject;
7
use Nip\Collections\Typed\ClassCollection;
8
use Nip\Utility\Number;
9
10
/**
11
 * Class ClassCollectionTest
12
 * @package Nip\Collections\Tests\Typed
13
 */
14
class ClassCollectionTest extends AbstractTest
15
{
16
    use AbstractTypeTraitTest {
17
        newCollection as newCollectionTrait;
18
    }
19
20
    /**
21
     * @return \Nip\Collections\Typed\AbstractTypedCollection
22
     */
23
    protected function newCollection()
24
    {
25
        $collection = $this->newCollectionTrait();
26
        $collection->validClass(BaseObject::class);
0 ignored issues
show
Bug introduced by
The method validClass() does not exist on Nip\Collections\Typed\AbstractTypedCollection. It seems like you code against a sub-type of Nip\Collections\Typed\AbstractTypedCollection such as Nip\Collections\Typed\ClassCollection. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

26
        $collection->/** @scrutinizer ignore-call */ 
27
                     validClass(BaseObject::class);
Loading history...
27
        return $collection;
28
    }
29
30
    /**
31
     * @return string
32
     */
33
    protected function typeClass()
34
    {
35
        return ClassCollection::class;
36
    }
37
38
    protected function typeInvalidValues(): array
39
    {
40
        return ['string', new \stdClass(), new Number()];
41
    }
42
43
    protected function typeValidValues(): array
44
    {
45
        return [new BaseObject()];
46
    }
47
}
48