This repo is a proposed solution for the Gilded Rose kata. Credit to https://github.com/emilybache/GildedRose-Refactoring-Kata for hosting and maintaining the code this repo was built from.
See the top level readme for general information about this exercise. This is the PHP version of the GildedRose Kata.
The kata uses:
Recommended:
Clone the repository
git clone git@github.com:emilybache/GildedRose-Refactoring-Kata.gitor
git clone https://github.com/emilybache/GildedRose-Refactoring-Kata.gitInstall all the dependencies using composer
cd ./GildedRose-Refactoring-Kata/php
composer installThe project uses composer to install:
src- contains the two classes:Item.php- this class should not be changedGildedRose.php- this class needs to be refactored, and the new feature added
tests- contains the testsGildedRoseTest.php- starter test.- Tip: ApprovalTests has been included as a dev dependency, see the PHP version of the Theatrical Players Refactoring Kata for an example
Fixturetexttest_fixture.phpthis could be used by an ApprovalTests, or run from the command line
PHPUnit is configured for testing, a composer script has been provided. To run the unit tests, from the root of the PHP project run:
composer testA Windows a batch file has been created, like an alias on Linux/Mac (e.g. alias pu="composer test"), the same
PHPUnit composer test can be run:
puTo run all test and generate a html coverage report run:
composer test-coverageThe test-coverage report will be created in /builds, it is best viewed by opening /builds/index.html in your browser.
Easy Coding Standard (ECS) is configured for style and code standards, PSR-12 is used. The current code is not upto standard!
To check code, but not fix errors:
composer check-csOn Windows a batch file has been created, like an alias on Linux/Mac (e.g. alias cc="composer check-cs"), the same
PHPUnit composer check-cs can be run:
ccECS provides may code fixes, automatically, if advised to run --fix, the following script can be run:
composer fix-csOn Windows a batch file has been created, like an alias on Linux/Mac (e.g. alias fc="composer fix-cs"), the same
PHPUnit composer fix-cs can be run:
fcPHPStan is used to run static analysis checks:
composer phpstanOn Windows a batch file has been created, like an alias on Linux/Mac (e.g. alias ps="composer phpstan"), the same
PHPUnit composer phpstan can be run:
psHappy coding!