GildedRose-Refactoring-Kata/php
Pen-y-Fan ed7a787e4f Updated PHP version for PHP7.2+
Removed PHP5 (no longer supported)
Renamed PHP7 to PHP - consistent with other kata
Added the same helpers as other PHP Kata
Updated the code to PHP7.2+ standard
Didn't change GildedRose updateQuality method
Updated GildedRoseTest (still failing)
Added ApprovalTest (passing)
- same text file as texttests / ThirtyDays / stdout.gr (only renamed).
2020-07-23 22:47:36 +01:00
..
fixtures Updated PHP version for PHP7.2+ 2020-07-23 22:47:36 +01:00
src Updated PHP version for PHP7.2+ 2020-07-23 22:47:36 +01:00
tests Updated PHP version for PHP7.2+ 2020-07-23 22:47:36 +01:00
.editorconfig Updated PHP version for PHP7.2+ 2020-07-23 22:47:36 +01:00
.gitignore Updated PHP version for PHP7.2+ 2020-07-23 22:47:36 +01:00
cc.bat Updated PHP version for PHP7.2+ 2020-07-23 22:47:36 +01:00
composer.json Updated PHP version for PHP7.2+ 2020-07-23 22:47:36 +01:00
composer.lock Updated PHP version for PHP7.2+ 2020-07-23 22:47:36 +01:00
ecs.yaml Updated PHP version for PHP7.2+ 2020-07-23 22:47:36 +01:00
fc.bat Updated PHP version for PHP7.2+ 2020-07-23 22:47:36 +01:00
phpstan.neon Updated PHP version for PHP7.2+ 2020-07-23 22:47:36 +01:00
phpunit.xml Updated PHP version for PHP7.2+ 2020-07-23 22:47:36 +01:00
ps.bat Updated PHP version for PHP7.2+ 2020-07-23 22:47:36 +01:00
pu.bat Updated PHP version for PHP7.2+ 2020-07-23 22:47:36 +01:00
README.md Updated PHP version for PHP7.2+ 2020-07-23 22:47:36 +01:00

GildedRose Kata - PHP Version

See the top level readme for general information about this exercise. This is the PHP version of the GildedRose Kata.

Installation

The kata uses:

Recommended:

Clone the repository

git clone git@github.com:emilybache/GildedRose-Refactoring-Kata.git

or

git clone https://github.com/emilybache/GildedRose-Refactoring-Kata.git

Install all the dependencies using composer

cd ./GildedRose-Refactoring-Kata/php
composer install

Dependencies

The project uses composer to install:

Folders

  • src - contains the two classes:
    • Item.php - this class should not be changed.
    • GildedRose.php - this class needs to be refactored, and the new feature added.
  • tests - contains the tests
    • GildedRoseTest.php - Starter test.
    • ApprovalTest.php - alternative approval test (set to 30 days)
  • Fixture
    • texttest_fixture.php used by the approval test, or can be run from the command line

Testing

PHPUnit is pre-configured to run tests. PHPUnit can be run using a composer script. To run the unit tests, from the root of the PHP project run:

composer test

On Windows a batch file has been created, similar to an alias on Linux/Mac (e.g. alias pu="composer test"), the same PHPUnit composer test can be run:

pu

Tests with Coverage Report

To run all test and generate a html coverage report run:

composer test-coverage

The test-coverage report will be created in /builds, it is best viewed by opening index.html in your browser.

Code Standard

Easy Coding Standard (ECS) is used to check for style and code standards, PSR-12 is used. The current code is not upto standard!

Check Code

To check code, but not fix errors:

composer check-cs

On Windows a batch file has been created, similar to an alias on Linux/Mac (e.g. alias cc="composer check-cs"), the same PHPUnit composer check-cs can be run:

cc

Fix Code

There are may code fixes automatically provided by ECS, if advised to run --fix, the following script can be run:

composer fix-cs

On Windows a batch file has been created, similar to an alias on Linux/Mac (e.g. alias fc="composer fix-cs"), the same PHPUnit composer fix-cs can be run:

fc

Static Analysis

PHPStan is used to run static analysis checks:

composer phpstan

On Windows a batch file has been created, similar to an alias on Linux/Mac (e.g. alias ps="composer phpstan"), the same PHPUnit composer phpstan can be run:

ps

Happy coding!