AggregateTest::testOffsetSetAndOffsetGet()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 4
rs 10
1
<?php
2
3
namespace Test\Common;
4
5
use Guillermoandrae\Common\AbstractAggregate;
6
use PHPUnit\Framework\TestCase;
7
use ArrayIterator;
8
9
class AggregateTest extends TestCase
10
{
11
    /**
12
     * @var AbstractAggregate
13
     */
14
    protected AbstractAggregate $aggregate;
15
16
    public function testSetAndGet()
17
    {
18
        $this->aggregate->set(1, 2);
19
        $this->assertSame(2, $this->aggregate->get(1));
20
    }
21
22
    public function testOffsetSetAndOffsetGet()
23
    {
24
        $this->aggregate->offsetSet(2, 3);
25
        $this->assertSame(3, $this->aggregate->offsetGet(2));
26
    }
27
28
    public function testGetIterator()
29
    {
30
        $this->assertInstanceOf(
31
            ArrayIterator::class,
32
            $this->aggregate->getIterator()
33
        );
34
    }
35
36
    protected function setUp(): void
37
    {
38
        $this->aggregate = $this->getMockForAbstractClass(
0 ignored issues
show
Documentation Bug introduced by
It seems like $this->getMockForAbstrac...class, array(array(1))) of type PHPUnit\Framework\MockObject\MockObject is incompatible with the declared type Guillermoandrae\Common\AbstractAggregate of property $aggregate.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
39
            AbstractAggregate::class,
40
            [[1]]
41
        );
42
    }
43
}
44