public function testOnceHandler() { $rawTitle = ' Hello world!!! '; $this->filters->once('before_output_title', 'trim'); $this->filters->filter('before_output_title', $rawTitle); $title = $this->filters->filter('before_output_title', $rawTitle); self::assertEquals($rawTitle, $title); }
public function testStopPropagation() { $rawTitle = ' Hello world!!! '; $this->filters->on('before_output_title', 'trim'); $this->filters->on('before_output_title', function ($value) { throw (new StopPropagation())->setValue($value); }); $this->filters->on('before_output_title', [$this, 'customFilterHandler']); $title = $this->filters->filter('before_output_title', $rawTitle); self::assertEquals('Hello world!!!', $title); }
protected function filterMethod($method, $params, $callback, $filters = array()) { return Filters::filter($this, $method, $params, $callback, $filters); }
protected static function filterStaticMethod($method, $params, $callback, $filters = array()) { return Filters::filter(get_called_class(), $method, $params, $callback, $filters); }