gwa / mockery-wp-bridge
WpBridge is a simple bridge to mock all wordpress function.
Installs: 1 333
Dependents: 2
Suggesters: 0
Security: 0
Stars: 0
Watchers: 3
Forks: 2
Open Issues: 0
Requires
- php: >=5.4.0
- mockery/mockery: ^0.9
Requires (Dev)
- fabpot/php-cs-fixer: ^1.11
- phpunit/phpunit: ^4.8
README
Master
Install
Via Composer
$ composer require gwa/wp-bridge
Usage
First init WpBridge
class.
$bridge = new \Gwa\Wordpress\WpBridge\WpBridge();
Now it allows us to use a class to call methods in the global namespace. Methods should be called in camelcase.
// To call wp_get_attachment_image_src(...); // use $bridge->wpGetAttachmentImageSrc(...);
Or you like to use a trait, than set WpBridgeTrait
in a class.
use Gwa\Wordpress\WpBridge\Traits\WpBridgeTrait; class TestClass { use WpBridgeTrait; public function testFunc() { $img = $this->getWpBridge()->wpGetAttachmentImageSrc(...); ... } } $test = new TestClass(); $test->setWpBridge($bridge);
Change log
Please see CHANGELOG for more information what has changed recently.
Testing
$ composer test
Contributing
Please see CONTRIBUTING for details.
Credits
License
The MIT License (MIT). Please see License File for more information.