Skip to content

Commit 2008a35

Browse files
committed
tests updated
1 parent 61b860e commit 2008a35

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

tests/TypedArrayTest.php

+13
Original file line numberDiff line numberDiff line change
@@ -274,4 +274,17 @@ public function testAssignWrongTypedValueToArray($type, $value)
274274
$array = new TypedArray($type);
275275
$array[] = $value;
276276
}
277+
278+
/**
279+
* Test iterator.
280+
*/
281+
public function testIteratorClass()
282+
{
283+
$arrayAsParam = ['a','b','c','d','e','f','g','h','i'];
284+
$array = new TypedArray('string', $arrayAsParam);
285+
286+
foreach ($array as $key => $value) {
287+
$this->assertEquals($value, $arrayAsParam[$key]);
288+
}
289+
}
277290
}

tests/TypedObjectArrayTest.php

+19
Original file line numberDiff line numberDiff line change
@@ -98,4 +98,23 @@ public function testAssignWrongTypedValueToArray()
9898
$array = new TypedObjectArray(ArrayObject::class);
9999
$array[] = new SplStack();
100100
}
101+
102+
/**
103+
* Test iterator.
104+
*/
105+
public function testIteratorClass()
106+
{
107+
$arrayAsParam = [
108+
new ArrayObject([1, 2, 3]),
109+
new ArrayObject(['1', '2', '3']),
110+
new ArrayObject([true, false, null]),
111+
new ArrayObject([1.0, 2.0, 3.0])
112+
];
113+
114+
$array = new TypedObjectArray(ArrayObject::class, $arrayAsParam);
115+
116+
foreach ($array as $key => $value) {
117+
$this->assertEquals($value, $arrayAsParam[$key]);
118+
}
119+
}
101120
}

0 commit comments

Comments
 (0)