Skip to content

Testing class that ignores everything while still being valid

License

Notifications You must be signed in to change notification settings

CodeDruids/black-hole

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BlackHole

Latest release Build Status Code Coverage Code Quality Software License

BlackHole is a PHP testing class that ignores anything done to it.

Requirements

  • PHP 5.6 or higher

Installation

Add the following to your composer.json:

{
    "require": {
        "CodeDruids/black-hole": "1.*"
    }
}

Basic Usage

$test = new \CodeDruids\BlackHole("test");

$test->a = "b";
unset($test->c);
isset($test->d)
$test->e("f");
\CodeDruids\BlackHole::g("h")
var_dump($test);
echo $test;
$test();

This can be useful when you need a placeholder object, or want the ability to switch a class alias to remove any impact on a production environment. e.g.

if (env('APP_ENV') == 'production') {
	class_alias('CodeDruids\BlackHole', 'Debug');
}
else {
	class_alias('My\Clever\Debugger', 'Debug');
}
Debug::log('Profound silence');

Support

If you believe you have found a bug, please report it using the GitHub issue tracker, or better yet, fork the library and submit a pull request.

About

Testing class that ignores everything while still being valid

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages