GildedRose-Refactoring-Kata/php/fixtures/texttest_fixture.php
naciriii 66867fbe7a refactor: set global architecture and refactor code
- Create an Ioc container and set factories and services
- Adjust degrading Strategies
- Clean up and do global chores here and there and avoid Dry code
- Write unit and integration tests and ensure correct business logic
2022-03-30 05:34:47 +01:00

42 lines
1.1 KiB
PHP

<?php
declare(strict_types=1);
require_once __DIR__ . '/../vendor/autoload.php';
use GildedRose\Core\Container;
use GildedRose\GildedRose;
use GildedRose\Item;
echo 'OMGHAI!' . PHP_EOL;
$items = [
new Item('+5 Dexterity Vest', 10, 20),
new Item('Aged Brie', 2, 0),
new Item('Elixir of the Mongoose', 5, 7),
new Item('Sulfuras, Hand of Ragnaros', 0, 80),
new Item('Sulfuras, Hand of Ragnaros', -1, 80),
new Item('Backstage passes to a TAFKAL80ETC concert', 15, 20),
new Item('Backstage passes to a TAFKAL80ETC concert', 10, 49),
new Item('Backstage passes to a TAFKAL80ETC concert', 5, 49),
// this conjured item does not work properly yet
new Item('Conjured Mana Cake', 3, 6),
];
$app = (new Container())->get(GildedRose::class, [$items]);
$days = 2;
if (count($argv) > 1) {
$days = (int) $argv[1];
}
for ($i = 0; $i < $days; $i++) {
echo "-------- day ${i} --------" . PHP_EOL;
echo 'name, sellIn, quality' . PHP_EOL;
foreach ($items as $item) {
echo $item . PHP_EOL;
}
echo PHP_EOL;
$app->updateQuality();
}