public static function addFilter($tag, $fn, $priority = 10, $acceptedArgs = 1) { if (self::$type === HookMock::WP_MOCK) { \WP_Mock::onFilterAdded($tag)->react($fn, (int) $priority, (int) $acceptedArgs); } if (self::$type === HookMock::TRUE_HOOKS) { self::$hooks['filters'][$tag][] = ['fn' => $fn, 'priority' => $priority, 'args' => $acceptedArgs]; } }
/** * Dummy method to prevent filter hooks in constructor from failing. */ function add_filter($tag, $function_to_add, $priority = 10, $accepted_args = 1) { \WP_Mock::onFilterAdded($tag)->react($function_to_add, (int) $priority, (int) $accepted_args); }