mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2026-10-15 02:25:40 +00:00
Add PHP8
- update README.md with latest PHP information - update composer.json to support PHP 7.3 to PHP8 - active support for PHP 7.2 ended 6 Dec 2020 - PHP8 was released 26-Nov-2020 - update the dependencies - PHPUnit now version 9.5 and config file updated - ECS now version 9.3 and config file changed from `ecs.yaml` to `ecs.php` ApprovalTest removed, in line with latest readme, all set for refactoring :) Tested with PHP 7.3, 7.4 and 8.0 one failing "fixme" != "foo" test!
This commit is contained in:
1 parent
179a22ecfa
commit
10d3cf7f5a
9 files changed
+2569
-1391
No files matched your search
+27
-23
@@ -1,16 +1,17 @@
|
||||
# GildedRose Kata - PHP Version
|
||||
|
||||
See the [top level readme](../README.md) for general information about this exercise. This is the PHP version of the
|
||||
GildedRose Kata.
|
||||
GildedRose Kata.
|
||||
|
||||
## Installation
|
||||
|
||||
The kata uses:
|
||||
|
||||
- PHP 7.2+
|
||||
- [PHP 7.3 or 7.4 or 8.0+](https://www.php.net/downloads.php)
|
||||
- [Composer](https://getcomposer.org)
|
||||
|
||||
Recommended:
|
||||
|
||||
- [Git](https://git-scm.com/downloads)
|
||||
|
||||
Clone the repository
|
||||
@@ -39,31 +40,33 @@ The project uses composer to install:
|
||||
- [PHPUnit](https://phpunit.de/)
|
||||
- [ApprovalTests.PHP](https://github.com/approvals/ApprovalTests.php)
|
||||
- [PHPStan](https://github.com/phpstan/phpstan)
|
||||
- [Easy Coding Standard (ECS)](https://github.com/symplify/easy-coding-standard)
|
||||
- [Easy Coding Standard (ECS)](https://github.com/symplify/easy-coding-standard)
|
||||
- [PHP CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer/wiki)
|
||||
|
||||
## 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.
|
||||
- `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)
|
||||
- `GildedRoseTest.php` - starter test.
|
||||
- Tip: ApprovalTests has been included as a dev dependency, see the PHP version of
|
||||
the [Theatrical Players Refactoring Kata](https://github.com/emilybache/Theatrical-Players-Refactoring-Kata/)
|
||||
for an example
|
||||
- `Fixture`
|
||||
- `texttest_fixture.php` used by the approval test, or can be run from the command line
|
||||
- `texttest_fixture.php` this could be used by an ApprovalTests, or 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:
|
||||
PHPUnit is configured for testing, a composer script has been provided. To run the unit tests, from the root of the PHP
|
||||
project run:
|
||||
|
||||
```shell script
|
||||
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:
|
||||
A 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:
|
||||
|
||||
```shell script
|
||||
pu
|
||||
@@ -77,12 +80,13 @@ 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.
|
||||
The test-coverage report will be created in /builds, it is best viewed by opening /builds/**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!
|
||||
Easy Coding Standard (ECS) is configured for style and code standards, **PSR-12** is used. The current code is not upto
|
||||
standard!
|
||||
|
||||
### Check Code
|
||||
|
||||
@@ -92,8 +96,8 @@ 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:
|
||||
On 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:
|
||||
|
||||
```shell script
|
||||
cc
|
||||
@@ -101,14 +105,14 @@ cc
|
||||
|
||||
### Fix Code
|
||||
|
||||
There are may code fixes automatically provided by ECS, if advised to run --fix, the following script can be run:
|
||||
ECS provides may code fixes, automatically, if advised to run --fix, the following script can be run:
|
||||
|
||||
```shell script
|
||||
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:
|
||||
On 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:
|
||||
|
||||
```shell script
|
||||
fc
|
||||
@@ -122,11 +126,11 @@ 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:
|
||||
On 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:
|
||||
|
||||
```shell script
|
||||
ps
|
||||
```
|
||||
|
||||
**Happy coding**!
|
||||
**Happy coding**!
|
||||
Reference in new issue
Block a user