WPBrowser module updated with core and new test cases.
Test case classes refresh
I’ve pushed version 1.7.13
of the WP Browser module for Codeception and took the time to sync the test cases included in the suite with those coming from the WordPress automated testing suite; some new methods the core team added while working with and on the tests were missing and it was time to update the embedded ones.
Together with this I’ve duplicated the code in the base test classes to extend Codeception base test class and allow for any Codeception annotation magic to happen.
To make an example the new test class structure is now
\Codeception\TestCase\WPTestCase extends \Codeception\TestCase\Test and has the code of the \WP_UnitTestCase class
while before any test generated using the wpcept generate:wpunit
command was an extension of the base \WP_UnitTestCase
class.
New generation powers
Speaking about generation I’ve added four new commands to generate any one of the new test case classes; straight from the readme file here are the new commands.
generate:wpunit
Generates a test case extending the \Codeception\TestCase\WPTestCase
class using the
wpcept generate:wpunit suite SomeClass
The command will generate a skeleton test case like
<?php
class SomeClassTest extends \Codeception\TestCase\WPTestCase
{
protected function setUp()
{
parent::setUp();
}
protected function tearDown()
{
parent::tearDown();
}
// tests
public function testMe()
{
}
}
generate:wprest
Generates a test case extending the \Codeception\TestCase\WPRestApiTestCase
class using the
wpcept generate:wprest suite SomeClass
The command will generate a skeleton test case like
<?php
class SomeClassTest extends \Codeception\TestCase\WPRestApiTestCase
{
protected function setUp()
{
parent::setUp();
}
protected function tearDown()
{
parent::tearDown();
}
// tests
public function testMe()
{
}
}
generate:wpajax
Generates a test case extending the \Codeception\TestCase\WPAjaxTestCase
class using the
wpcept generate:wpajax suite SomeClass
The command will generate a skeleton test case like
<?php
class SomeClassTest extends \Codeception\TestCase\WPAjaxTestCase
{
protected function setUp()
{
parent::setUp();
}
protected function tearDown()
{
parent::tearDown();
}
// tests
public function testMe()
{
}
}
generate:wpxmlrpc
Generates a test case extending the \Codeception\TestCase\WPXMLRPCTestCase
class using the
wpcept generate:wpxmlrpc suite SomeClass
The command will generate a skeleton test case like
<?php
class SomeClassTest extends \Codeception\TestCase\WPXMLRPCTestCase
{
protected function setUp()
{
parent::setUp();
}
protected function tearDown()
{
parent::tearDown();
}
// tests
public function testMe()
{
}
}
generate:wpcanonical
Generates a test case extending the \Codeception\TestCase\WPCanonicalTestCase
class using the
wpcept generate:wpcanonical suite SomeClass
The command will generate a skeleton test case like
<?php
class SomeClassTest extends \Codeception\TestCase\WPCanonicalTestCase
{
protected function setUp()
{
parent::setUp();
}
protected function tearDown()
{
parent::tearDown();
}
// tests
public function testMe()
{
}
}
Next
I will work on some edge cases I came across while working for clients and come back to the tool anytime an issue arises.