addFilterPrefix() public static method

The backslash at the end is required; e.g. for class "\Api\ToInt" the prefix would be "\Api\" a filter name "ToInt".
public static addFilterPrefix ( string $prefix )
$prefix string
Example #1
0
 /**
  * Tests creating a filter instance with a custom prefix.
  */
 public function testCustomFilterPrefix()
 {
     $filterName = 'Filter';
     $filterPrefix = '\\SomePrefix\\Some\\';
     // Ensure that there is no such class loaded
     if (class_exists($filterName, false)) {
         $this->markTestSkipped(sprintf('Class %s exists', $filterName));
     }
     try {
         $this->factory->getFilterByName($filterName);
         $this->fail(sprintf('Expected exception %s.', \Jyxo\Input\Exception::class));
     } catch (\PHPUnit_Framework_ExpectationFailedException $e) {
         throw $e;
     } catch (\Exception $e) {
         $this->assertInstanceOf(\Jyxo\Input\Exception::class, $e);
     }
     $this->factory->addFilterPrefix($filterPrefix);
     $filter = $this->factory->getFilterByName($filterName);
 }