oliverklee/dungeon-of-bugs

A console-based dungeon crawler game which I use in my TDD workshops.

dev-main 2024-11-14 12:55 UTC

This package is auto-updated.

Last update: 2024-11-14 12:56:31 UTC


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

Running only the unit tests

Running only the functional tests

Running a single testcase

This example is for running the testcase

In PHPStorm

First, you need to configure the PHP interpreter in PHPStorm:

After this, configure PHPUnit:

  1. enter the PhpStorm settings
  2. PHP > Test Frameworks
  3. add a new PHPUnit configuration
  4. in "PHPUnit library", select "Use Composer autoloader" and set vendor/autoload.php as path
  5. in "Test Runner", select "Default configuration file" and set phpunit.xml as 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.