Embedded WP 0.0.2

Added support for required plugins and activation.

Required plugins

The wp-embedded module is aimed at making WordPress functional testing, and hence WordPress test-driven development a self-contained and autonomous reality.
It’s meant to be wp-browser WPLoader module smaller brother.
The first version offered just a basic implementation of the idea but was missing two important features.
A test code example shows those limits


class pluginTest extends \WP_UnitTestCase

    protected $backupGlobals = false;

    public function setUp()
        // before

        // your set up methods here

    public function tearDown()
        // your tear down methods here

        // then

    public function test_slashit()
        $this->assertEquals('foo/', myplugin_slashit('foo'));

    public function test_activation()
        $this->assertEquals('yes', get_option('myplugin_did_activate'));

     * required plugin is available
    public function test_required_plugin_is_available()
        $this->assertEquals(false, p2p_connection_exists('some_connection'));

     * main plugin is active
    public function test_main_plugin_is_active()

     * required plugin is active
    public function test_required_plugin_is_active()

and the code of the plugin under test is

 * Plugin Name: My Plugin
 * Plugin URI: http://theAverageDev.com
 * Description: My test plugin
 * Version: 1.0
 * Author: theAverageDev
 * Author URI: http://theAverageDev.com
 * License: GPL 2.0

require_once 'vendor/autoload.php';

register_activation_hook(__FILE__, function () {
    update_option('myplugin_did_activate', 'yes');

if (!function_exists('myplugin_slashit')) {
    function myplugin_slashit($string)
        return trailingslashit($string);

The last three tests would not pass in the first version of the module. This has been fixed in version 0.0.2 of the module to have all of tests pass.

Configuration of required plugins and active ones

Again code speaks more than words: the configuration file that makes the tests pass defines some additional settings:

actor: Tester
    tests: tests
    log: tests/_output
    data: tests/_data
    support: tests/_support
    envs: tests/_envs
    bootstrap: _bootstrap.php
    colors: true
    memory_limit: 1024M
        - Codeception\Extension\RunFailed
              - /Users/Luca/Desktop/posts-to-posts/posts-to-posts.php
            mainFile: my-plugin.php
              - posts-to-posts/posts-to-posts.php
              - my-plugin.php


Theme support; this is missing and the module lends itself to the use and the scenario.