I've reused my PHP BoilerPlate Template to work through the Advent of Code 2021 challenges at https://adventofcode.com/2021/
For each day, I will write unit tests to help me solve the challenge using the sample data set and also test my code.
So far, the main
branch contains code for these solved days -
- Day 2 (parts 1 and 2)
- Clone the repo locally and
cd
to the new directory - Run
composer install
- Run
composer start
- Open
localhost:8095
in a browser
composer test
NB: this is setup in composer.json
to run with the --testdox
option to give more readable test output, like this -
> phpunit tests --testdox
BoilerPlate
✔ Success AddSomething
✔ Failure example numbers not equals
✔ Malformed adding int to array returns error
Time: 177 ms, Memory: 4.00 MB
OK (3 tests, 3 assertions)
Without --testdox
, the test output looks like this -
> phpunit tests
... 3 / 3 (100%)
Time: 241 ms, Memory: 4.00 MB
OK (3 tests, 3 assertions)