예제 #1
0
 public function testSettingDefaultOptionsAfterwards()
 {
     $filter = new CallbackFilter(array($this, 'objectCallback'));
     $filter->setCallbackParams('param');
     $this->assertEquals(array('param'), $filter->getCallbackParams());
     $this->assertEquals('objectCallback-test', $filter('test'));
 }
예제 #2
0
 /**
  * Sets a new Closure for this filter
  *
  * @param  Closure $callback
  * @throws Exception\InvalidArgumentException
  * @return self
  */
 public function setCallback($callback)
 {
     if (!$callback instanceof Closure) {
         throw new Exception\InvalidArgumentException(sprintf('Invalid parameter for callback: must be %s', Closure::class));
     }
     return parent::setCallback($callback);
 }