2017 © Pedro Peláez
 

library tester

An object oriented approach to testing for PHP.

image

thomasnordahldk/tester

An object oriented approach to testing for PHP.

  • Tuesday, January 9, 2018
  • by thomasnordahl-dk
  • Repository
  • 1 Watchers
  • 1 Stars
  • 21 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 8 Versions
  • 11 % Grown

The README.md

thomasnordahldk/tester

PHP Version Latest Stable Version License Build Status, (*1)

An object oriented approach to testing PHP code., (*2)

Tester aims to be: easy to learn, light weight, object oriented, and extensible., (*3)

Documentation here, (*4)

Installation

The library is released as a composer package., (*5)

composer require --dev thomasnordahldk/tester

Tests

Tests are defined by creating TestCase classes., (*6)

class MyTestCase implements TestCase
{
    public function getDescription(): string
    {
        return "My new unit test";
    }

    public function run(Tester $tester): void
    {
        $tester->assert(true, "This assertion passes!");
        $tester->assert(false, "This assertion fails!");
    }
}

The test case is defined as a description of the test and a run test method., (*7)

Docs: Creating a test case., (*8)

Test suites

Tests suites are defined by the TestSuite class which is created with a description and an array of TestCase classes., (*9)

$unit_tests = new TestSuite("Unit tests", [new UserUnitTest, AddressUnitTest]);

Docs: Test Suites., (*10)

Running tests

The library comes with a native test runner that is run from the command line interface, and outputs a summary of the test., (*11)

Which tests to run is defined in the file test.php in the root composer directory. The file is expected to return an array of test suites., (*12)

# test.php
$unit_tests = new TestSuite("Unit tests", [new UserUnitTest, new AddressUnitTest]);

return [$unit_tests];

$composer-root/~ bin/tester

---------------------------------------------------------------------------
 - Unit tests - cases: 2
 --- Unit test of User ✔
 --- Unit test of Address ✔
---------------------------------------------------------------------------
success: 2, failure: 0, assertions: 8, time: 0.04s
---------------------------------------------------------------------------

For a comprehensive description of the options available for the native test runner script:, (*13)

Docs: How to run tests., (*14)

Inspiration

This library is inspired by the testing library mindplay-dk/testies., (*15)

The Versions

09/01 2018

dev-master

9999999-dev

An object oriented approach to testing for PHP.

  Sources   Download

MIT

The Requires

 

by Thomas Pedersen

07/01 2018

0.3.1

0.3.1.0

An object oriented approach to testing for PHP.

  Sources   Download

MIT

The Requires

 

by Thomas Pedersen

05/01 2018

0.3.0

0.3.0.0

An object oriented approach to testing for PHP.

  Sources   Download

MIT

The Requires

 

by Thomas Pedersen

24/10 2017

0.3.0.x-dev

0.3.0.9999999-dev

An object oriented approach to testing for PHP.

  Sources   Download

MIT

The Requires

 

by Thomas Pedersen

13/10 2017

0.2.1

0.2.1.0

An object oriented approach to testing for PHP.

  Sources   Download

MIT

The Requires

 

by Thomas Pedersen

12/10 2017

0.2.0

0.2.0.0

An object oriented approach to testing for PHP.

  Sources   Download

MIT

The Requires

 

by Thomas Pedersen

29/09 2017

0.1.1

0.1.1.0

An object oriented approach to testing for PHP.

  Sources   Download

MIT

The Requires

 

by Thomas Pedersen

29/09 2017

0.1.0

0.1.0.0

An object oriented approach to testing for PHP.

  Sources   Download

MIT

The Requires

 

by Thomas Pedersen