guillermoandrae /
php-collection
| 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
|
|||
| 39 | AbstractAggregate::class, |
||
| 40 | [[1]] |
||
| 41 | ); |
||
| 42 | } |
||
| 43 | } |
||
| 44 |
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..