\Dewdrop\BootstrapWp

Bootstrap Dewdrop in a WP environment by providing the needed resources, drawing upon information from WP's config.

If you need to define a custom bootstrap class for your WP plugin, you can do so by specifying that class in your wp-config.php. For example:

define('DEWDROP_BOOTSTRAP_CLASS', '\My\Project\Bootstrap');

Summary

Methods
Properties
Constants
__construct()
handleWpLoadGlobals()
getPimple()
defineConfig()
defineDb()
defineAdmin()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
$pimple
N/A

Properties

$pimple

$pimple : \Pimple

The Pimple DI container used to provide resources to Dewdrop.

Type

\Pimple

Methods

__construct()

__construct() 

Define all the needed resources for Dewdrop.

handleWpLoadGlobals()

handleWpLoadGlobals() 

This is a hack to try to deal with WordPress globals in PHPUnit's bootstrap, which is run in the scope of a function and therefore doesn't allow these global variables to their polluted hellscape they were originally intended for. Particularly nasty is the fact that $redirection is in this list. It is brought in by a redirector plugin, which like WP core and many other poorly written plugins, relies on certain globals being around.

There must be a way to at least disable other plugins during testing, so we can at least limit the nastiness to only WP core. We could probably look at WP core's unit test suite to find that trick. In the meantime, it's best if you test Dewdrop against a clean WP install, not a site with tons of activated plugins.

getPimple()

getPimple() : \Pimple

Hand over the Pimple.

Returns

\Pimple

defineConfig()

defineConfig() : \Dewdrop\Bootstrap\Wp

Define config resource for Pimple. Nothing much to do for WP.

Returns

\Dewdrop\Bootstrap\Wp

defineDb()

defineDb() : \Dewdrop\Bootstrap\Wp

Define the DB resource for Pimple.

Returns

\Dewdrop\Bootstrap\Wp

defineAdmin()

defineAdmin() : \Dewdrop\Bootstrap\Wp

Provide a \Dewdrop\Admin\Env\Wp object so that Dewdrop admin components can work inside the WP admin shell.

Returns

\Dewdrop\Bootstrap\Wp