1.1
This release adds simple methods to Integration\TestCase. They are like WordPress’ __return_false() and its friends, for the same purpose: hook callbacks during our tests.
So then why create these instead of using WordPress’ ones?
add_filter( 'rocket_do_something', '__return_false' );
// Something to test...
remove_filter( 'rocket_do_something', '__return_false' );Because when doing this, we may remove a __return_false() that could have been added externally by the plugin itself or something else. So by using our own methods we prevent changing the initial behavior.
Also:
We added a way to exclude tests from being processed by phpunit. It is as easy as adding a group to a method:
class CustomTestCase extends TestCase {
/**
* @group Exclude
*/
public function testFoobar() {
// Prevent a warning. This should not run.
$this->assertTrue( true );
}
}As you probably guessed, the magic word is Exclude.
Note: unfortunately that doesn't seem to work at the class level, only at the method level 😭