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