2017 © Pedro Peláez
 

library sliver

A tiny PHP test framework.

image

maxvu/sliver

A tiny PHP test framework.

  • Sunday, July 10, 2016
  • by maxvu
  • Repository
  • 1 Watchers
  • 3 Stars
  • 53 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 1 Open issues
  • 4 Versions
  • 0 % Grown

The README.md

sliver

A simple, closure-based Test class., (*1)

Quick start

Rope in sliver as a Composer dependency:, (*2)

# composer require --dev maxvu/sliver

Instantiate maxvu\sliver\Test, using a closure exhibiting the behavior to test as its only constructor argument., (*3)

name( '1 + 1 = 2' );
];
?>

Use $test->assert() to capture a value and any of the following methods to apply expectations to it:, (*4)

<?php
$test->assert( $a )->like( $b )       # $a == $b
$test->assert( $a )->eq( $b )         # $a === $b
$test->assert( $a )->ne( $b )         # $a != $b
$test->assert( $a )->gt( $b )         # $a > $b
$test->assert( $a )->ge( $b )         # $a >= $b
$test->assert( $a )->lt( $b )         # $a < $b
$test->assert( $a )->le( $b )         # $a <= $b
$test->assert( $a )->null( $b )       # $a === null
$test->assert( $a )->true( $b )       # $a === true
$test->assert( $a )->false( $b )      # $a === false
$test->assert( $a )->truthy( $b )     # $a
$test->assert( $a )->falsy( $b )      # !$a
$test->assert( $a )->contains( $b )   # in_array( $b, $a ) OR
                                      # false !== strpos( strval( $a ), strval( $b ) )
$test->assert( $a )->matches( $b )    # preg_match( $b, $a );
?>

Provide a list of these Tests to a maxvu\sliver\Runner (like maxvu\sliver\ConsoleRunner) and call run() on it:, (*5)

assert( 1 + 1 )->eq( 2 );
    } ))->name( '1 + 1 = 2' )
]))->show_passing( 1 )->run();
?>

Have printed out to the console information about each test:, (*6)

$ php tests.php

    1 + 1 = 2 [ OK ] (0.00045s)

    1 / 1 tests passing (100.00%)
    2 / 2 conditions passing (100.00%)

$

The Versions

10/07 2016

dev-master

9999999-dev http://github.com/maxvu/sliver

A tiny PHP test framework.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

test framework unit

10/07 2016

2.0.0

2.0.0.0 http://github.com/maxvu/sliver

A tiny PHP test framework.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

test framework unit

22/03 2015

1.0.0

1.0.0.0 http://github.com/maxvu/sliver

A tiny PHP test framework.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

test framework unit

13/03 2015

dev-rewrite-a

dev-rewrite-a http://github.com/maxvu/sliver

A tiny PHP test framework.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

test framework unit