Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[12] - Running tests on PHP8.1 improved #13

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions KoansLib/KoanPrinter.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ class KoanPrinter extends CliTestDoxPrinter
{
public function printResult(TestResult $result): void
{
$this->printHeader();
$this->printHeader($result);

$this->printFooter($result);
}

protected function printHeader(): void
protected function printHeader($result): void
{
$this->write("\n\n");
}
Expand Down
22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

PHP Koans is heavily based on Greg Malcolm's [Python Koans](https://github.com/gregmalcolm/python_koans), which is based on Edgecase's [Ruby Koans](http://rubykoans.com/). Much credit to both projects. Thank you!

![PHP Koans Screenshot](screenshots/php_koans.png?raw=true "PHP Koans Screenshot")

PHP Koans is an interactive tutorial for learning the PHP programming language by making tests pass.

Most tests are fixed by filling the missing parts of assert functions. Eg:
Expand Down Expand Up @@ -105,16 +103,10 @@ docker run -ti php-koans

## Getting Started

From a *nix terminal or windows command prompt go to the php_koans folder and run:

```
php contempate_koans
```

In my I fire up my Terminal app and run this:

![PHP Koans Screenshot](screenshots/php_koans-step1.png?raw=true "PHP Koans First Run")
If all the koans are to be executed from terminal:
./vendor/bin/phpunit -c phpunit.xml

![PHP Koans Screenshot](screenshots/run_all_koans.png?raw=true "PHP Koans Screenshot")

Apparently, a test failed:

Expand All @@ -124,6 +116,14 @@ Failed asserting that false is true.

It also tells me exactly where the problem is, it's an assert on line 15 of .\koans\AssertKoans.php. This one is easy, just change `FALSE` to `TRUE` to make the test pass.

If only koans of a class are to be executed:
./vendor/bin/phpunit -c phpunit.xml koans/StringManipulationKoans.php
![PHP Koans Screenshot](screenshots/run_specific_koans_class.png?raw=true "PHP Koans Screenshot")

We can also adjust if we want the koans to keep running after one fails or we want ot continue:

![PHP Koans Screenshot](screenshots/adjust_stop_on_failure.png?raw=true "PHP Koans Screenshot")

## PHPUnit

This koans project uses Sebastian Bergmann's wonderful [PHPUnit](https://phpunit.de/) command ([source code](https://github.com/sebastianbergmann/phpunit)). The PHAR binary is included in this project for convenience and to lower the setup curve. It has been renamed from `phpunit` to `contemplate_koans` to fit with the theme of this project. See `LICENSE_PHPUnit` for the relevant license information.
Expand Down
42 changes: 21 additions & 21 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading