Tester - Unit Testing for Php

Its a unit testing library. But @hard_link(https://phpunit.de, phpunit) is probably better.

Install

@template(composer_install, taeluf/tester)

Usage

In a terminal, run phptest or ./vendor/bin/phptest from your project root. (depending whether you installed via bash or composer)

Example Test class:

@file(test/input/Runner/run/Test.php)

Options

  • phptest init to initialize test setups for a new project
  • phptest server to run a localhost php development server, used for testing
  • phptest -test TestName to only run the given test. Multiple -test TestName flags can be given
  • phptest -class ClassName where for \Ns\Test\ClassName, you just pass ClassName. accepts multiple -class flags.
  • any other flags found in @see_file(code/defaults.json) can be passed as to phptest as well.

Available Assertions

I'll properly document assertions after I write the php grammar for my @easy_link(gitlab, taeluf/php/lexer) See @see_file(code/Tester/Assertions.php) and for other functionality, see the traits in @see_file(code/Tester/)

Alternate Installation

This also requires @easy_link(tlf, code-scrawl) for development, which is not handled by this script.
copy+paste this into a bash terminal @template(bash_install, phptest, code/phptest)