From 0f3421589136ffd3ab3e636562a1d2a0788fa1a4 Mon Sep 17 00:00:00 2001 From: Povilas Brilius Date: Fri, 1 May 2020 23:57:56 +0300 Subject: [PATCH] Lower quality boundary on regular product runs OK. --- php7/test/GildedRoseTest.php | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/php7/test/GildedRoseTest.php b/php7/test/GildedRoseTest.php index 56301614..4edc0ac2 100644 --- a/php7/test/GildedRoseTest.php +++ b/php7/test/GildedRoseTest.php @@ -215,7 +215,34 @@ class GildedRoseTest extends \PHPUnit\Framework\TestCase } $this->assertEquals(50, $app->getItems()[0]->quality); + $this->assertEquals(50, $app->getItems()[1]->quality); + $this->assertEquals(50, $app->getItems()[2]->quality); } + /** + * Test lower quality boundary of a product is prevalent + * + * @return void + */ + public function testQualityLowerBoundaryOnRegularProduct() + { + $items = [ + new Item('Elixir of the Mongoose', 5, 1), + new Item('Elixir of the Mongoose', 5, 2), + new Item('Elixir of the Mongoose', 5, 3), + ]; + + $interval = 3; + $app = new GildedRose($items); + + for ($i = 0; $i < $interval; $i++) { + $app->updateQuality(); + } + + $this->assertEquals(0, $app->getItems()[0]->quality); + $this->assertEquals(0, $app->getItems()[1]->quality); + $this->assertEquals(0, $app->getItems()[2]->quality); + } + }