You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While attempting to develop in situ PHPUnit tests for the acf-fields-block plugin I had problems due to the default WordPress unit test case class restoring hooks that had been attached by dependent plugins. In this case it was Advanced Custom Fields PRO.
My workaround was to comment out the call to _restore_hooks() in the tearDown() method.
I then decided to allow the plugin's PHPUnit tests to decide whether or not to restore hooks.
The solution is to add a new method dont_restore_hooks() which will set $this->restore_hooks to false
and to change tearDown()to call maybe_restore_hooks() instead of _restore_hooks().
The calling test class overrides the tearDown() method as follows.
function tearDown() : void {
$this->dont_restore_hooks();
parent::tearDown();
}
The text was updated successfully, but these errors were encountered:
While attempting to develop in situ PHPUnit tests for the acf-fields-block plugin I had problems due to the default WordPress unit test case class restoring hooks that had been attached by dependent plugins. In this case it was Advanced Custom Fields PRO.
See bobbingwide/field-block-for-acf-pro#15 (comment)
My workaround was to comment out the call to
_restore_hooks()
in thetearDown()
method.I then decided to allow the plugin's PHPUnit tests to decide whether or not to restore hooks.
The solution is to add a new method
dont_restore_hooks()
which will set$this->restore_hooks
to falseand to change
tearDown()
to callmaybe_restore_hooks()
instead of_restore_hooks()
.The calling test class overrides the
tearDown()
method as follows.The text was updated successfully, but these errors were encountered: