diff --git a/php/src/GildedRose.php b/php/src/GildedRose.php index db81ee3b..2d46d339 100644 --- a/php/src/GildedRose.php +++ b/php/src/GildedRose.php @@ -17,16 +17,16 @@ final class GildedRose public function updateQuality(): void { foreach ($this->items as $item) { - if ($item->name != 'Aged Brie' and $item->name != 'Backstage passes to a TAFKAL80ETC concert') { + if ($item->name !== 'Aged Brie' and $item->name !== 'Backstage passes to a TAFKAL80ETC concert') { if ($item->quality > 0) { - if ($item->name != 'Sulfuras, Hand of Ragnaros') { + if ($item->name !== 'Sulfuras, Hand of Ragnaros') { $item->quality = $item->quality - 1; } } } else { if ($item->quality < 50) { $item->quality = $item->quality + 1; - if ($item->name == 'Backstage passes to a TAFKAL80ETC concert') { + if ($item->name === 'Backstage passes to a TAFKAL80ETC concert') { if ($item->sellIn < 11) { if ($item->quality < 50) { $item->quality = $item->quality + 1; @@ -41,15 +41,15 @@ final class GildedRose } } - if ($item->name != 'Sulfuras, Hand of Ragnaros') { + if ($item->name !== 'Sulfuras, Hand of Ragnaros') { $item->sellIn = $item->sellIn - 1; } if ($item->sellIn < 0) { - if ($item->name != 'Aged Brie') { - if ($item->name != 'Backstage passes to a TAFKAL80ETC concert') { + if ($item->name !== 'Aged Brie') { + if ($item->name !== 'Backstage passes to a TAFKAL80ETC concert') { if ($item->quality > 0) { - if ($item->name != 'Sulfuras, Hand of Ragnaros') { + if ($item->name !== 'Sulfuras, Hand of Ragnaros') { $item->quality = $item->quality - 1; } } diff --git a/php/tests/ApprovalTest.php b/php/tests/ApprovalTest.php index 0c7220e3..5de922a0 100644 --- a/php/tests/ApprovalTest.php +++ b/php/tests/ApprovalTest.php @@ -4,14 +4,14 @@ declare(strict_types=1); namespace Tests; +use ApprovalTests\Approvals; use GildedRose\GildedRose; use GildedRose\Item; use PHPUnit\Framework\TestCase; -use ApprovalTests\Approvals; /** * This unit test uses [Approvals](https://github.com/approvals/ApprovalTests.php). - * + * * There are two test cases here with different styles: *
  • "foo" is more similar to the unit test from the 'Java' version *
  • "thirtyDays" is more similar to the TextTest from the 'Java' version @@ -20,23 +20,22 @@ use ApprovalTests\Approvals; */ class ApprovalTest extends TestCase { - - public function testFoo(): void + public function testFoo(): void { $items = [new Item('foo', 0, 0)]; $app = new GildedRose($items); $app->updateQuality(); - Approvals::verifyList($items); - } + Approvals::verifyList($items); + } public function testThirtyDays(): void - { + { ob_start(); - $argv = ["", "30"]; - include(__DIR__.'/../fixtures/texttest_fixture.php'); - + $argv = ['', '30']; + include(__DIR__ . '/../fixtures/texttest_fixture.php'); + $output = ob_get_clean(); Approvals::approveString($output);