Registry / testing / brain-monkey

brain-monkey

JSON →
library2.7.0phppackagistunverified

Mocking utility for PHP functions and WordPress plugin API.

composer require brain/monkey
INSTALL
IMPORT
SIG · BRAIN-MONKEY
B
brain-monkey
testingphpv2.7.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Functions
use Brain\Monkey\Functions;

Mock a WordPress function using Brain Monkey.

use Brain\Monkey\Functions; Functions\when('wp_get_current_user')->justReturn((object) ['ID' => 1]); $user = wp_get_current_user(); // Returns user object with ID 1
Debug
Known issues
gotchaRequires PHP 7.1+ and may conflict with other mocking frameworks.
fix
Ensure no other function mocking libraries are loaded simultaneously.
affects: >=2.0.0
Upgrade
Version history
2.7.0latest on Packagist
Audit
Dependencies

No dependency data recorded yet.

Agent activity
17 hits · last 30 days
node
14
Amazon
1
OpenAI (training)
1
Resources
brain-monkey — pip install brain-monkey · libregistry