phine/test

This package is abandoned and no longer maintained. No replacement package was suggested.

A PHP library for improving unit testing.

Maintainers

👁 kherge

Package info

github.com/kherge-archive/lib-test

Homepage

Issues

pkg:composer/phine/test

Statistics

Installs: 1 506

Dependents: 10

Suggesters: 0

Stars: 2

1.0.1 2013-12-30 23:23 UTC

Requires

Requires (Dev)

Suggests

None

Provides

None

Conflicts

None

Replaces

None

MIT ee73521c48026fe66fb5d6f8a4437dc16efd5b30

testunit

This package is not auto-updated.

Last update: 2021-12-07 01:42:46 UTC


README

👁 Build Status
👁 Coverage Status
👁 Latest Stable Version
👁 Total Downloads

A PHP library for improving unit testing.

Usage

use Phine\Test\Method;
use Phine\Test\Property;
use Phine\Test\Temp;

class Example
{
 private static $isStatic = 'original';

 private $nonStatic = 'original';

 protected static function isStatic($arg)
 {
 return "Static: $arg";
 }

 protected function nonStatic($arg)
 {
 return "Non static: $arg";
 }
}

$example = new Example();

// retrieve hidden values
echo Property::get('Example', 'isStatic'); // "original"
echo Property::get($example, 'nonStatic'); // "original"

// change hidden values
Property::set('Example', 'isStatic', 'changed');
Property::set($example, 'nonStatic', 'changed');

echo Property::get('Example', 'isStatic'); // "changed"
echo Property::get($example, 'nonStatic'); // "changed"

// invoke hidden methods
echo Method::invoke('Example', 'isStatic', 123); // "Static: 123"
echo Method::invoke($example, 'nonStatic', 456); // "Non static: 456"

echo Method::invokeArgs('Example', 'isStatic', array(123)); // "Static: 123"
echo Method::invokeArgs($example, 'nonStatic', array(456)); // "Static: 456"

$temp = new Temp();

// create temporary paths
$dir = $temp->createDir();
$file = $temp->createFile();

// copy existing paths to temporary ones (names are preserved)
$dir = $temp->copyDir('/path/to/dir');
$file = $temp->copyFile('/path/to/file');

// purge all temporary paths
$temp->purgePaths();

Requirement

Installation

Via Composer:

$ composer require "phine/test=~1.0"

Documentation

You can find the documentation in the docs/ directory.

License

This library is available under the MIT license.