diff --git a/.gitignore b/.gitignore index fd27a97..6d77a74 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ build composer.lock +coverage phpunit.xml vendor humbug.json diff --git a/test/ProducerTraitTest.php b/test/ProducerTraitTest.php index 579f3c0..c02d474 100644 --- a/test/ProducerTraitTest.php +++ b/test/ProducerTraitTest.php @@ -186,4 +186,30 @@ class ProducerTraitTest extends TestCase { $this->assertTrue($invoked); throw $reason; } + + /** + * @expectedException \Error + * @expectedExceptionMessage The prior promise returned must resolve before invoking this method again + */ + public function testDoubleAdvance() { + $this->producer->advance(); + $this->producer->advance(); + } + + /** + * @expectedException \Error + * @expectedExceptionMessage Promise returned from advance() must resolve before calling this method + */ + public function testGetCurrentBeforeAdvance() { + $this->producer->getCurrent(); + } + + /** + * @expectedException \Error + * @expectedExceptionMessage Iterator has already been completed + */ + public function testDoubleComplete() { + $this->producer->complete(); + $this->producer->complete(); + } }