codedruids / black-hole
Testing class that ignores everything while still being valid
v1.1
2020-08-08 04:02 UTC
Requires
- php: >=5.6.0
Requires (Dev)
- php: >=7.3.0
- phpunit/phpunit: ^9.2
- squizlabs/php_codesniffer: ^3.5
This package is auto-updated.
Last update: 2024-11-08 14:46:42 UTC
README
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.