Abstracts WP's remove_all_filters function and fixes export test

This commit is contained in:
Vlad
2018-04-13 14:20:53 -04:00
parent 8f6ae91924
commit 6c64ba90c7
2 changed files with 20 additions and 15 deletions

View File

@ -26,6 +26,10 @@ class Hooks {
return self::callWithFallback('remove_action', func_get_args());
}
static function removeAllFilters() {
return self::callWithFallback('remove_all_filters', func_get_args());
}
private static function callWithFallback($func, $args) {
$local_func = __NAMESPACE__ . '\\' . $func;
if(function_exists($local_func)) {

View File

@ -86,6 +86,7 @@ class DynamicSubscribersGetterTest extends \MailPoetTest {
$entity->value = $this->subscribers_data[1][1];
$entity->save();
Hooks::removeAllFilters('mailpoet_get_segment_filters');
Hooks::addAction(
'mailpoet_get_segment_filters',
function($segment_id) {