oliverklee/dungeon-of-bugs
Composer 安装命令:
composer create-project oliverklee/dungeon-of-bugs
包简介
A console-based dungeon crawler game which I use in my TDD workshops.
README 文档
README
This project is a dungeon crawler game using PHP and the Symfony console.
It also is an exercise for my workshops on test-driven development (PHP).
Requirements
You'll need one of these:
- local PHP 8.3+ and Composer 2
- Docker and DDEV
Running the game
With local PHP:
bin/dungeon-of-bugs <path-to-level-file>
With DDEV:
ddev exec dungeon-of-bugs
Running the PHPUnit tests
On the command line
Running all tests
| Description | Command |
|---|---|
| Composer script with local PHP | composer ci:tests:all |
| direct PHPUnit call with local PHP | vendor/bin/phpunit --testsuite all |
| Composer script with DDEV | ddev composer ci:tests:all |
| direct PHPUnit call with DDEV | ddev exec phpunit --testsuite all |
Running only the unit tests
| Description | Command |
|---|---|
| Composer script with local PHP | composer ci:tests:unit |
| direct PHPUnit call with local PHP | vendor/bin/phpunit --testsuite unit |
| Composer script with DDEV | ddev composer ci:tests:unit |
| direct PHPUnit call with DDEV | ddev exec phpunit --testsuite unit |
Running only the functional tests
| Description | Command |
|---|---|
| Composer script with local PHP | composer ci:tests:functional |
| direct PHPUnit call with local PHP | vendor/bin/phpunit --testsuite functional |
| Composer script with DDEV | ddev composer ci:tests:functional |
| direct PHPUnit call with DDEV | ddev exec phpunit --testsuite functional |
Running a single testcase
This example is for running the testcase
| Description | Command |
|---|---|
| direct PHPUnit call with local PHP | vendor/bin/phpunit tests/Unit/PlaceholderTest.php |
| direct PHPUnit call with DDEV | ddev exec phpunit tests/Unit/PlaceholderTest.php |
In PHPStorm
First, you need to configure the PHP interpreter in PHPStorm:
After this, configure PHPUnit:
- enter the PhpStorm settings
- PHP > Test Frameworks
- add a new PHPUnit configuration
- in "PHPUnit library",
select "Use Composer autoloader" and set
vendor/autoload.phpas path - in "Test Runner",
select "Default configuration file" and set
phpunit.xmlas path to script
Now you can right-click on a testcase or a directory and select "Run".
Credits
Part of the code has been copied from the Snake Console game by @dbu.
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-05-23