2017 © Pedro Peláez
 

library phpt-tests-runner

Runner for PHPT tests (with few differences comparing to original PHPT format)

image

nazar-pc/phpt-tests-runner

Runner for PHPT tests (with few differences comparing to original PHPT format)

  • Tuesday, January 30, 2018
  • by nazar-pc
  • Repository
  • 3 Watchers
  • 7 Stars
  • 71 Installations
  • PHP
  • 2 Dependents
  • 0 Suggesters
  • 2 Forks
  • 2 Open issues
  • 12 Versions
  • 0 % Grown

The README.md

PHPT tests runner - Runner for PHPT tests (with few differences comparing to original PHPT format)

PHPT Tests runner

Usage:
  phpt-tests-runner [-h] [-c] [-C] [-b binary] [files] [directories]

Arguments:
  -h Print this help message
  -b Specify custom PHP binary to be used (current is used by default)
  -c Force colored output
  -C Force no colored output

Examples:
  Execute tests from tests directory:
    phpt-tests-runner tests
  Execute tests single test:
    phpt-tests-runner tests/sample.phpt
  Execute tests from tests directory, but skip slow tests using environment variable:
    SKIP_SLOW_TESTS=1 phpt-tests-runner tests

PHPT Format:
  This runner uses modification of PHPT format used by PHP itself, so that it can run many original PHPT tests without any changes.

  PHPT test if text file with *.phpt extension.
  Each file contains sections followed by section contents, everything before first section is ignored, you can use it for storing test description.

  Required sections are --FILE-- and one of [--EXPECT--, --EXPECTF--, --EXPECTREGEX--].

PHPT sections supported:
  --FILE--        The test source code
  --EXPECT--      The expected output from the test script (will be executed as PHP script, so it might be code as well as plain text)
  --EXPECTF--     Similar to --EXPECT--, but it uses substitution tags for strings, spaces, digits, which may vary between test runs
    The following is a list of all tags and what they are used to represent:
      %s One or more of anything (character or white space) except the end of line character
      %S Zero or more of anything (character or white space) except the end of line character
      %a One or more of anything (character or white space) including the end of line character
      %A Zero or more of anything (character or white space) including the end of line character
      %w Zero or more white space characters
      %i A signed integer value, for example +3142, -3142
      %d An unsigned integer value, for example 123456
      %x One or more hexadecimal character. That is, characters in the range 0-9, a-f, A-F
      %f A floating point number, for example: 3.142, -3.142, 3.142E-10, 3.142e+10
      %c A single character of any sort (.)
  --EXPECTREGEX-- Similar to --EXPECT--, but is treated as regular expression
  --SKIPIF--      If output of execution starts with `skip` then test will be skipped
  --INI--         Specific php.ini setting for the test, one per line
  --ARGS--        A single line defining the arguments passed to php
  --CLEAN--       Code that is executed after a test completes

PHPT tests examples:
  Examples can be found at <https://qa.php.net/phpt_details.php> (taking into account differences here)

Main differences from original PHPT tests files:
  1. --TEST-- is not required and not even used (files names are used instead)
  2. Only sub-set of sections supported and only sub-set of --EXPECTF-- tags
  3. --EXPECT*-- sections are interpreted as code and its output is used as expected result

Requirements:

  • PHP 7.0+

How to use?

Simply add dependency on nazar-pc/phpt-tests-runner to your project's composer.json:, (*1)

{
    "require-dev": {
        "nazar-pc/phpt-tests-runner": "1.*"
    }
}

Then execute tests as following:, (*2)

vendor/bin/phpt-tests-runner tests

Or if you need environment variables to propagate into tests:, (*3)

php -d variables_order=EGPCS vendor/bin/phpt-tests-runner tests

Alternatively you can install it globally using Composer like this:, (*4)

sudo COMPOSER_BIN_DIR=/usr/local/bin composer global require nazar-pc/phpt-tests-runner

COMPOSER_BIN_DIR=/usr/local/bin will instruct Composer to install binary to /usr/local/bin so that you'll be able to call just phpt-tests-runner after installation. Alternatively you can skip it and add ~/.composer/vendor/bin/ to your PATH., (*5)

Contribution

Feel free to create issues and send pull requests, they are highly appreciated!, (*6)

License

Free Public License 1.0.0 / Zero Clause BSD License, (*7)

https://opensource.org/licenses/FPL-1.0.0, (*8)

https://tldrlegal.com/license/bsd-0-clause-license, (*9)

The Versions

30/01 2018

dev-master

9999999-dev https://github.com/nazar-pc/phpt-tests-runner

Runner for PHPT tests (with few differences comparing to original PHPT format)

  Sources   Download

MIT 0BSD

The Requires

  • php >=7.0

 

test testing phpt

30/01 2018

1.4.1

1.4.1.0 https://github.com/nazar-pc/phpt-tests-runner

Runner for PHPT tests (with few differences comparing to original PHPT format)

  Sources   Download

0BSD

The Requires

  • php >=7.0

 

test testing phpt

29/01 2018

1.4.0

1.4.0.0 https://github.com/nazar-pc/phpt-tests-runner

Runner for PHPT tests (with few differences comparing to original PHPT format)

  Sources   Download

0BSD

The Requires

  • php >=7.0

 

test testing phpt

29/01 2018

1.3.2

1.3.2.0 https://github.com/nazar-pc/phpt-tests-runner

Runner for PHPT tests (with few differences comparing to original PHPT format)

  Sources   Download

0BSD

The Requires

  • php >=7.0

 

test testing phpt

29/01 2018

1.3.1

1.3.1.0 https://github.com/nazar-pc/phpt-tests-runner

Runner for PHPT tests (with few differences comparing to original PHPT format)

  Sources   Download

0BSD

The Requires

  • php >=7.0

 

test testing phpt

29/01 2018

1.3.0

1.3.0.0 https://github.com/nazar-pc/phpt-tests-runner

Runner for PHPT tests (with few differences comparing to original PHPT format)

  Sources   Download

0BSD

The Requires

  • php >=7.0

 

test testing phpt

24/07 2016

1.2.1

1.2.1.0 https://github.com/nazar-pc/phpt-tests-runner

Runner for PHPT tests (with few differences comparing to original PHPT format)

  Sources   Download

MIT

The Requires

  • php >=5.6

 

test testing phpt

23/07 2016

1.2.0

1.2.0.0 https://github.com/nazar-pc/phpt-tests-runner

Runner for PHPT tests (with few differences comparing to original PHPT format)

  Sources   Download

MIT

The Requires

  • php >=5.6

 

test testing phpt

13/07 2016

1.1.2

1.1.2.0 https://github.com/nazar-pc/phpt-tests-runner

Runner for PHPT tests (with few differences comparing to original PHPT format)

  Sources   Download

MIT

The Requires

  • php >=5.6

 

test testing phpt

13/07 2016

1.1.1

1.1.1.0 https://github.com/nazar-pc/phpt-tests-runner

Runner for PHPT tests (with few differences comparing to original PHPT format)

  Sources   Download

MIT

The Requires

  • php >=5.6

 

test testing phpt

26/06 2016

1.1.0

1.1.0.0 https://github.com/nazar-pc/phpt-tests-runner

Runner for PHPT tests (with few differences comparing to original PHPT format)

  Sources   Download

MIT

The Requires

  • php >=5.6

 

test testing phpt

11/05 2016

1.0.0

1.0.0.0 https://github.com/nazar-pc/phpt-tests-runner

Runner for PHPT tests (with few differences comparing to original PHPT format)

  Sources   Download

MIT

The Requires

  • php >=5.6

 

test testing phpt