Returns an iterator for all currently loaded plugin instances.
public getIterator ( $new = true ) : ArrayIterator | ||
리턴 | ArrayIterator |
/** * Tests that multiple plugin iterators can be used concurrently. * * @return void */ public function testUseMultiplePluginIteratorsConcurrently() { $plugin1 = $this->getMockPlugin('TestPlugin1'); $this->handler->addPlugin($plugin1); $plugin2 = $this->getMockPlugin('TestPlugin2'); $this->handler->addPlugin($plugin2); $iterator1 = $this->handler->getIterator(); $iterator1->next(); $this->assertSame($plugin2, $iterator1->current()); $iterator2 = $this->handler->getIterator(); $this->assertSame($plugin1, $iterator2->current()); }
/** * Ensures that we can iterate over the handler * * @return void */ public function testImplementsIterator() { $reflection = new ReflectionObject($this->handler); $this->assertTrue($reflection->implementsInterface('IteratorAggregate')); $this->assertType('Iterator', $this->handler->getIterator(), 'getIterator() must actually return an Iterator'); }