/** * @depends test_getIterator_any_returnsCorrectInstance * @dataProvider provide_rangeZeroToN */ function test_containsN_returnsKeyValuePairCorrectly($dataToAdd) { $map = new HashMap(); foreach ($dataToAdd as $key => $value) { $map[$key] = $value; } foreach ($map->getIterator() as $key => $value) { $expect = $dataToAdd[$key]; $this->assertEquals($expect, $value); } }
public function testGetIterator() { // Remove the following lines when you implement this test. $it = $this->object->getIterator(); $this->assertTrue($it instanceof \blaze\collections\MapIterator); $test = false; foreach ($this->object as $val) { $test = true; } $this->assertTrue($test); $it->next(); $it->next(); $it->next(); $it->next(); $it->remove(); }
function test_isEmpty_empty_returnsTrue() { $map = new HashMap(); $this->assertTrue($map->isEmpty()); $this->assertTrue($map->getIterator()->isEmpty()); }