ailixter/aiixtest

There is no license information available for the latest version (dev-master) of this package.

Test snippets runner.

dev-master 2020-10-29 12:15 UTC

This package is auto-updated.

Last update: 2024-03-26 17:55:39 UTC


README

PHP test snippets runner

Yes, "snippets" means snippets. Any valid php file could be run, its $vars are printed and its return remembered and analysed.

Installation

$ git clone https://github.com/ailixter/aiixtest.git
cd aiixtest
$ php aiixtest.php

or

$ php composer require-dev ailixter/aiixtest
$ ./vendor/bin/aiixtest.php

archive could just be downloaded and unarchived.

Example:

o==============================================================================o
|   test/argv.php                                                              |
o==============================================================================o
   1| <?php
   2|
   3|
   4| global $argv;
   5| reset($argv);
   6| while (($arg = next($argv)) !== false) {
   7|     $array[] = $arg;
   8| }
   9|
  10| return "new return";
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
RETURNED: string(10) "new return"
EXPECTED: int(1)
--------------------------------------------------------------------------------
Vars after:

shared $array: array (
  0 => 'php',
);

$argv: array (
  0 => 'C:\\Work\\php\\aiixtest\\aiixtest.php',
  1 => 'php',
);

$arg: false;

All what it needs is a test directory, which structure follows:

my-tests
    |
    \-init
    |   |
    |   \-(initialization files)*
    |
    \-test
        |
        \-(test files)+

Then a testing could be started with:

$ cd my-project
$ php aiixtest.php my-tests

See even more at the wiki