loresjoberg / warp
A passthrough to WordPress, used to enable unit testing.
v1.0.1
2018-07-23 05:01 UTC
Requires
- php: >=5.4
This package is not auto-updated.
Last update: 2024-10-13 05:18:39 UTC
README
Here's why this class exists: WordPress pollutes the global namespace something awful, and there's nothing we can do about that.
However, we can voluntarily "wrap" WordPress in a class, and choose to only access it through that class. Why would we want to do that? The main reason is unit testing. By accessing WordPress's global functions only through this class, we can easily mock it up and test without instantiating all of WordPress, setting up a database, so on and so forth.
Installation
Install using [Composer][composer]:
composer require loresjoberg/warp
Usage
$warp = new \LoreSjoberg\Warp();
$result = $warp->count_users();