Skip to content

Commit

Permalink
tests updated
Browse files Browse the repository at this point in the history
  • Loading branch information
s3b4stian committed Oct 26, 2017
1 parent 61b860e commit 2008a35
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
13 changes: 13 additions & 0 deletions tests/TypedArrayTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -274,4 +274,17 @@ public function testAssignWrongTypedValueToArray($type, $value)
$array = new TypedArray($type);
$array[] = $value;
}

/**
* Test iterator.
*/
public function testIteratorClass()
{
$arrayAsParam = ['a','b','c','d','e','f','g','h','i'];
$array = new TypedArray('string', $arrayAsParam);

foreach ($array as $key => $value) {
$this->assertEquals($value, $arrayAsParam[$key]);
}
}
}
19 changes: 19 additions & 0 deletions tests/TypedObjectArrayTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,4 +98,23 @@ public function testAssignWrongTypedValueToArray()
$array = new TypedObjectArray(ArrayObject::class);
$array[] = new SplStack();
}

/**
* Test iterator.
*/
public function testIteratorClass()
{
$arrayAsParam = [
new ArrayObject([1, 2, 3]),
new ArrayObject(['1', '2', '3']),
new ArrayObject([true, false, null]),
new ArrayObject([1.0, 2.0, 3.0])
];

$array = new TypedObjectArray(ArrayObject::class, $arrayAsParam);

foreach ($array as $key => $value) {
$this->assertEquals($value, $arrayAsParam[$key]);
}
}
}

0 comments on commit 2008a35

Please sign in to comment.