@@ -4,9 +4,10 @@ A project to test your [CodinGame](https://www.codingame.com/) PHP code. It is n
44It only contains PHPUnit tests to let you code in your favorite IDE, outside of the CodinGame web site.
55
66[ ![ License] ( https://img.shields.io/github/license/cyrilverloop/codingame-php-tests )] ( https://github.com/cyrilverloop/codingame-php-tests/blob/trunk/LICENSE )
7- [ ![ PHP version] ( https://img.shields.io/badge/php-%3D7 .3-%23777BB4?logo=php&style=flat )] ( https://www.php.net/ )
7+ [ ![ PHP version] ( https://img.shields.io/badge/php-%3D8 .3-%23777BB4?logo=php&style=flat )] ( https://www.php.net/ )
88
9- ** This project now uses PHP 8.3+ and unfortunaly CodinGame is still on PHP 7.3
9+ ** This project now uses PHP 8.3+.
10+ Unfortunaly, CodinGame is still on PHP 7.3
1011which is not [ supported] ( https://www.php.net/supported-versions.php ) anymore.
1112If you want to run your code on PHP 7.3,
1213you can use a version up to 3.x of this software which do not receive further update.**
@@ -27,29 +28,33 @@ user@host projects$ cd codingame-php-tests
2728Copy some configuration files for Docker and PHPUnit :
2829``` shellsession
2930user@host projects $ cp ./ci/phpunit.dist.xml ./ci/phpunit.xml
31+ user@host projects $ cp ./.env.dist ./.env
3032user@host projects $ cp ./.ashrc.dist ./.ashrc
3133user@host projects $ cp ./docker-compose.override.yml.dist ./docker-compose.override.yml
3234```
33- The ` ./ci/phpunit.xml ` , ` ./.ashrc ` and ` ./docker-compose.override.yml ` files are ignored by git, you can modify them to your needs.
35+ Edit the ` ./.env ` to add your user to the container.
36+ The ` ./ci/phpunit.xml ` , ` ./.ashrc ` , ` ./.env ` and ` ./docker-compose.override.yml ` files are ignored by git, you can modify them to your needs.
3437The ` ./.ashrc ` and ` ./docker-compose.override.yml ` add some aliases to your container.
3538
3639Install the dependencies :
3740``` shellsession
3841user@host codingame-php-tests $ docker compose run --rm app composer install -o
39- user@host codingame-php-tests $ docker compose run --rm app phive install --trust-gpg-keys 4AA394086372C20A,12CE0F1D262429A5,31C7E470E2138192
42+ user@host codingame-php-tests $ docker compose run --rm app phive install --trust-gpg-keys 4AA394086372C20A,12CE0F1D262429A5,5E6DDE998AB73B8E,C5095986493B4AA0
4043```
4144
42-
43- ## Add your code
44-
45- Every classes in ` ./src/**/*.dist ` files have an ` execute() ` method with the default CodinGame code.
46- To try a puzzle, copy the corresponding file and change the extension to ` php ` :
45+ Generate the code and test files :
4746``` shellsession
48- user@host codingame-php-tests $ cp ./src/Training/Easy/Unary/Unary.dist ./src/Training/Easy/Unary/Unary.php
47+ user@host codingame-php-tests $ docker compose run --rm app bin/generate-tests
4948```
50- Then, add your code to solve the puzzle.
5149
52- ** If you change the class name or do not have an ` execute() ` method in it, the tests will not be able to run.**
50+ ** Existing code, test, input and output files will not be overwritten.
51+ To generate a file again, you must delete it first.**
52+
53+
54+ ## Add your code
55+
56+ Every classes in ` ./src/**/*CGCode.php ` files have an ` execute() ` method with the default CodinGame code.
57+ A test executes the ` CGCode::execute() ` method. You can add your code in and arround it.
5358
5459
5560## Test your solution
@@ -64,7 +69,7 @@ Execute all the tests :
6469phpunit
6570```
6671
67- Execute tests for a particular puzzle or a test case :
72+ Execute tests of a group :
6873``` shellsession
6974phpunit --group [GROUP_NAME]
7075```
@@ -85,7 +90,7 @@ Tip : to activate HTML coverage report and testdox logging, you can uncomment th
8590## Add your test (optional)
8691
8792Every tests in ` ./tests/**/CGTest.php ` files include the tests from CodinGame.
88- You can add your own tests in other ` ./tests/**/*Test.php ` files and add them to a group with the ` Group ` attribute.
93+ You can add your own tests and add them to a group with the ` Group ` attribute.
8994
9095
9196## Back to CodinGame
@@ -105,4 +110,4 @@ fscanf(STDIN, "%d", $N);
105110
106111## Time limit
107112
108- The maximum time allowed for a puzzle may differ from CodinGame.
113+ The maximum time allowed may differ from CodinGame.
0 commit comments