dontHaveInDatabase added to the WPDb Codeception module

I’ve updated the WP Browser package, a WordPress specific addition to Codeception modules meant to allow more streamlined testing of WordPress plugins and themes components, with some refactoring, an updated version of the README file and two new database-related methods.

ExtendedDb

I’ve modified the inherit chain to make the WPDb class (Codeception\Module\WPDb) extend the ExtendedDb class.
That’s an extended version of Codeception Db class implementing two methods I’ve felt the need for:

public function dontHaveInDatabase($table, array $criteria);

public function haveOrUpdateInDatabase($table, array $data)

Those methods will be available in the WPDb class in turn an will allow test cases like this one to be written.

<?php 
$I = new AcceptanceTester($scenario);
$I->wantTo('have full control of the database initial state');

// this option, already present in the database, will be updated
// a WPDb method
$I->haveOptionInDatabase('permalink_structure', '');

// this option will be inserted
// a WPDb method
$I->haveOptionInDatabase('veryUnlikelyOption', 'foo-baz-bar');

// remove an option from the database 
// an ExtendedDb method
$I->dontHaveInDatabase('wp_options', array('option_name' => 'gameChangerOption'))

// here be tests
...

On Packagist and GitHub

I’ve updated the package, meant to be used with Composer on Packagist and GitHub.