From 14cea0cbf0832c027d60d4915fd3ec570a13f422 Mon Sep 17 00:00:00 2001 From: Niklas Keller Date: Tue, 2 May 2017 18:10:10 +0200 Subject: [PATCH] :white_check_mark: Added further Internal\Producer tests --- .gitignore | 1 + test/ProducerTraitTest.php | 26 ++++++++++++++++++++++++++ 2 files changed, 27 insertions(+) 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(); + } }