@@ -4,9 +4,10 @@ A project to test your [CodinGame](https://www.codingame.com/) PHP code. It is n
4
4
It only contains PHPUnit tests to let you code in your favorite IDE, outside of the CodinGame web site.
5
5
6
6
[ ![ 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/ )
8
8
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
10
11
which is not [ supported] ( https://www.php.net/supported-versions.php ) anymore.
11
12
If you want to run your code on PHP 7.3,
12
13
you 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
27
28
Copy some configuration files for Docker and PHPUnit :
28
29
``` shellsession
29
30
user@host projects $ cp ./ci/phpunit.dist.xml ./ci/phpunit.xml
31
+ user@host projects $ cp ./.env.dist ./.env
30
32
user@host projects $ cp ./.ashrc.dist ./.ashrc
31
33
user@host projects $ cp ./docker-compose.override.yml.dist ./docker-compose.override.yml
32
34
```
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.
34
37
The ` ./.ashrc ` and ` ./docker-compose.override.yml ` add some aliases to your container.
35
38
36
39
Install the dependencies :
37
40
``` shellsession
38
41
user@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
40
43
```
41
44
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 :
47
46
``` 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
49
48
```
50
- Then, add your code to solve the puzzle.
51
49
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.
53
58
54
59
55
60
## Test your solution
@@ -64,7 +69,7 @@ Execute all the tests :
64
69
phpunit
65
70
```
66
71
67
- Execute tests for a particular puzzle or a test case :
72
+ Execute tests of a group :
68
73
``` shellsession
69
74
phpunit --group [GROUP_NAME]
70
75
```
@@ -85,7 +90,7 @@ Tip : to activate HTML coverage report and testdox logging, you can uncomment th
85
90
## Add your test (optional)
86
91
87
92
Every 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.
89
94
90
95
91
96
## Back to CodinGame
@@ -105,4 +110,4 @@ fscanf(STDIN, "%d", $N);
105
110
106
111
## Time limit
107
112
108
- The maximum time allowed for a puzzle may differ from CodinGame.
113
+ The maximum time allowed may differ from CodinGame.
0 commit comments