public function testIteratingDictionaryAndCount() { $keyValues = ['abc' => new TestType('def'), 'ghi' => new TestType('jkl'), 'mno' => new TestType('pqr')]; $dictionary = new Dictionary(gettype('teststring'), TestType::class); foreach ($keyValues as $key => $value) { $dictionary->add($key, $value); } foreach ($dictionary as $key => $value) { $this->assertEquals($keyValues[$key], $value); } $this->assertFalse($dictionary->current()); $dictionary->rewind(); $this->assertEquals($dictionary->current(), $keyValues[array_keys($keyValues)[0]]); $this->assertEquals(count($keyValues), count($dictionary)); }