@@ 74-81 (lines=8) @@ | ||
71 | * @param iterable $iterable |
|
72 | * @return void |
|
73 | */ |
|
74 | public function testAddingWrongTypeViaConstructor(iterable $iterable): void |
|
75 | { |
|
76 | $this->expectException(InvalidArgumentException::class); |
|
77 | ||
78 | $object = new DateTimeImmutable(); |
|
79 | $iterable[] = $object; |
|
80 | new ObjectArray(DateTime::class, $iterable); |
|
81 | } |
|
82 | ||
83 | /** |
|
84 | * @return void |
|
@@ 86-93 (lines=8) @@ | ||
83 | /** |
|
84 | * @return void |
|
85 | */ |
|
86 | public function testAddingWrongTypeViaOffsetSet(): void |
|
87 | { |
|
88 | $this->expectException(InvalidArgumentException::class); |
|
89 | ||
90 | $object = new DateTimeImmutable(); |
|
91 | $objectArray = new ObjectArray(DateTime::class); |
|
92 | $objectArray->offsetSet(0, $object); |
|
93 | } |
|
94 | ||
95 | /** |
|
96 | * @return void |
|
@@ 98-105 (lines=8) @@ | ||
95 | /** |
|
96 | * @return void |
|
97 | */ |
|
98 | public function testAddingWrongTypeViaAdd(): void |
|
99 | { |
|
100 | $this->expectException(InvalidArgumentException::class); |
|
101 | ||
102 | $object = new DateTimeImmutable(); |
|
103 | $objectArray = new ObjectArray(DateTime::class); |
|
104 | $objectArray->add($object); |
|
105 | } |
|
106 | ||
107 | /** |
|
108 | * @return void |
|
@@ 110-117 (lines=8) @@ | ||
107 | /** |
|
108 | * @return void |
|
109 | */ |
|
110 | public function testAddingWrongTypeViaArrayAccess(): void |
|
111 | { |
|
112 | $this->expectException(InvalidArgumentException::class); |
|
113 | ||
114 | $object = new DateTimeImmutable(); |
|
115 | $objectArray = new ObjectArray(DateTime::class); |
|
116 | $objectArray[0] = $object; |
|
117 | } |
|
118 | ||
119 | /** |
|
120 | * @return array |