+ /**
+ * Tests that a default iterator is returned if none is explicitly set.
+ *
+ * @return void
+ */
+ public function testGetIteratorReturnsDefault()
+ {
+ $this->assertType(
+ 'Phergie_Plugin_Iterator',
+ $this->handler->getIterator()
+ );
+ }
+
+ /**
+ * Tests the ability to change the handler's iterator class when a valid
+ * class is specified.
+ *
+ * @return void
+ */
+ public function testSetIteratorClassWithValidClass()
+ {
+ eval('
+ class DummyIterator extends FilterIterator {
+ public function accept() {
+ return true;
+ }
+ }
+ ');
+
+ $this->handler->setIteratorClass('DummyIterator');
+
+ $this->assertType(
+ 'DummyIterator',
+ $this->handler->getIterator()
+ );
+ }
+
+ /**
+ * Tests that a failure occurs when a nonexistent iterator class is
+ * specified.
+ *
+ * @return void
+ */
+ public function testSetIteratorClassWithNonexistentClass()
+ {
+ try {
+ $this->handler->setIteratorClass('FooIterator');
+ $this->fail('Expected exception was not thrown');
+ } catch (Phergie_Plugin_Exception $e) {
+ return;
+ }
+ $this->fail('Unexpected exception was thrown');
+ }
+
+ /**
+ * Tests that a failure occurs when a class that is not a subclass of
+ * FilterIterator is specified.
+ *
+ * @return void
+ */
+ public function testSetIteratorClassWithNonFilterIteratorClass()
+ {
+ try {
+ $this->handler->setIteratorClass('ArrayIterator');
+ $this->fail('Expected exception was not thrown');
+ } catch (Phergie_Plugin_Exception $e) {
+ return;
+ }
+ $this->fail('Unexpected exception was thrown');
+ }
+