Lower quality boundary on regular product runs OK.

This commit is contained in:
Povilas Brilius 2020-05-01 23:57:56 +03:00
parent cd58aa0141
commit 0f34215891

View File

@ -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);
}
}