WordPress Loader added to WP Browser package

What started as a proof-of-concept attempt at integrating the suite of automated tests part of WordPress core with Codeception resulted in the creation of a module.
I’ve added it to my WP Browser package and having added a lengthy README file I will skip long explanations moving to a workflow example.

A workflow example

Willing to test the (obvious) WordPress ability to store and retrieve an option I will require the Composer package in the composer.json file

// file composer.json

require-dev: {
    "lucatume/wp-browser": "1.*"

and after a composer update will configure my functional testing suite to use the WPLoader module

class_name: FunctionalTester
        - FunctionalHelper
        - WPLoader
            wpRootFolder: '/Users/Luca/www/site123'
            dbName: 'wordpress-tests'
            dbHost: ''
            dbUser: 'root'
            dbPassword: 'root'

After that and a codecept build I will be able to add my first test to the suite.
As reported in the README file the module will now support PHPUnit-like tests so I will generate such a test using Codeception CLI interface

codecept generate:phpunit functional Options

to have the OptionsTest test case class created in the /tests/functional folder.
Before adding any real test method I will modify the test case class the OptionTest class is extending from PHPUnit_Framework_TestCase


class OptionsTest extends \PHPUnit_Framework_TestCase
    protected function setUp()

    protected function tearDown()

    // tests
    public function testMe()

to the test case defined and used by the original WordPress suite


class OptionsTest extends \WP_UnitTestCase

and will add a first test method to the test case

    public function test_will_store_and_retrieve_an_option()
        add_option('some', 'foo');
        $this->assertEquals('foo', get_option('some'));

and will finally run the test again using Codeception CLI interface

codecept run functional

A WordPress installation fully functional and loaded in the global space means I can now access all of its globally defined functions, objects and methods and keep adding tests for the site/theme/plugin under development.

I appreciate your input