/** * Test if can iterate over the method `getAnnotation`. */ public function testIteratorOverAnnotation() { $number = 0; $list = new AnnotationList(); $list->addAnnotation(new ArrayValue(array())); $list->addAnnotation(new ArrayValue(array())); $list->addAnnotation(new ArrayValue(array())); $iterator = $list->getAnnotations(ArrayValue::NAME)->getIterator(); foreach ($iterator as $annotation) { $this->assertInstanceOf('\\com\\mohiva\\test\\resources\\common\\lang\\annotations\\ArrayValue', $annotation); $number++; } $this->assertEquals($number, 3); }