mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2026-02-17 23:41:27 +00:00
Stable product running OK.
This commit is contained in:
parent
1e1826519f
commit
91f8f6c62b
@ -41,6 +41,16 @@ final class GildedRose
|
|||||||
$this->_items = $items;
|
$this->_items = $items;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Items getter
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function getItems()
|
||||||
|
{
|
||||||
|
return $this->_items;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Advance by a time frame of 1 day
|
* Advance by a time frame of 1 day
|
||||||
*
|
*
|
||||||
|
|||||||
@ -22,11 +22,34 @@ namespace App;
|
|||||||
*/
|
*/
|
||||||
class GildedRoseTest extends \PHPUnit\Framework\TestCase
|
class GildedRoseTest extends \PHPUnit\Framework\TestCase
|
||||||
{
|
{
|
||||||
public function testFoo()
|
/**
|
||||||
|
* Product, that is unaffected by processing
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function testStableUnaffected()
|
||||||
{
|
{
|
||||||
$items = [new Item("foo", 0, 0)];
|
/**
|
||||||
$gildedRose = new GildedRose($items);
|
* Stock items
|
||||||
$gildedRose->updateQuality();
|
*
|
||||||
$this->assertEquals("fixme", $items[0]->name);
|
* @var Item[] $items
|
||||||
|
*/
|
||||||
|
$items = [
|
||||||
|
new Item('Sulfuras, Hand of Ragnaros', 2, 80),
|
||||||
|
new Item('Sulfuras, Hand of Ragnaros', -1, 80),
|
||||||
|
];
|
||||||
|
|
||||||
|
$interval = 6;
|
||||||
|
$app = new GildedRose($items);
|
||||||
|
|
||||||
|
for ($i = 0; $i < $interval; $i++) {
|
||||||
|
$app->updateQuality();
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->assertEquals(2, $app->getItems()[0]->sell_in);
|
||||||
|
$this->assertEquals(-1, $app->getItems()[1]->sell_in);
|
||||||
|
$this->assertEquals(80, $app->getItems()[0]->quality);
|
||||||
|
$this->assertEquals(80, $app->getItems()[1]->quality);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user