mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2026-02-16 06:51:27 +00:00
Quantity tests on simple products running.
This commit is contained in:
parent
7c001fbc5f
commit
4e98c86590
@ -63,7 +63,6 @@ final class GildedRose
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if ($item->name !== 'Aged Brie' && $item->name !== 'Backstage passes to a TAFKAL80ETC concert') {
|
if ($item->name !== 'Aged Brie' && $item->name !== 'Backstage passes to a TAFKAL80ETC concert') {
|
||||||
if ($item->quality > 0) {
|
if ($item->quality > 0) {
|
||||||
if (strstr($item->name, 'Conjured', true) === '') {
|
if (strstr($item->name, 'Conjured', true) === '') {
|
||||||
@ -88,7 +87,6 @@ final class GildedRose
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if ($item->sell_in < 0) {
|
if ($item->sell_in < 0) {
|
||||||
if ($item->name !== 'Aged Brie') {
|
if ($item->name !== 'Aged Brie') {
|
||||||
if ($item->name === 'Backstage passes to a TAFKAL80ETC concert') {
|
if ($item->name === 'Backstage passes to a TAFKAL80ETC concert') {
|
||||||
|
|||||||
@ -80,6 +80,34 @@ class GildedRoseTest extends \PHPUnit\Framework\TestCase
|
|||||||
$this->assertEquals(5, $app->getItems()[1]->sell_in);
|
$this->assertEquals(5, $app->getItems()[1]->sell_in);
|
||||||
$this->assertEquals(1, $app->getItems()[2]->sell_in);
|
$this->assertEquals(1, $app->getItems()[2]->sell_in);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Simple products quality and quantity test
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function testSimpleProducts()
|
||||||
|
{
|
||||||
|
$items = [
|
||||||
|
new Item('Elixir of the Mongoose', 16, 24),
|
||||||
|
new Item('Elixir of the Mongoose', 14, 32),
|
||||||
|
new Item('Elixir of the Mongoose', 12, 36),
|
||||||
|
new Item('Elixir of the Mongoose', 18, 25),
|
||||||
|
];
|
||||||
|
|
||||||
|
$interval = 5;
|
||||||
|
$app = new GildedRose($items);
|
||||||
|
|
||||||
|
for ($i = 0; $i < $interval; $i++) {
|
||||||
|
$app->updateQuality();
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->assertEquals(11, $app->getItems()[0]->sell_in);
|
||||||
|
$this->assertEquals(9, $app->getItems()[1]->sell_in);
|
||||||
|
$this->assertEquals(7, $app->getItems()[2]->sell_in);
|
||||||
|
$this->assertEquals(13, $app->getItems()[3]->sell_in);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user