コード例 #1
0
 public function testPassingPatternWithExecModifierRaisesException()
 {
     $filter = new PregReplaceFilter();
     $this->setExpectedException('Zend\\Filter\\Exception\\InvalidArgumentException', '"e" pattern modifier');
     $filter->setPattern('/foo/e');
 }
コード例 #2
0
ファイル: PregReplaceTest.php プロジェクト: haoyanfei/zf2
 public function testReplacementAccessorsWork()
 {
     $replacement = 'foo/bar';
     $this->filter->setReplacement($replacement);
     $this->assertEquals($replacement, $this->filter->getReplacement());
 }
コード例 #3
0
 /**
  * Do the real work, replaces the seperator to search for with the replacement seperator
  *
  * Returns the replaced string
  *
  * @param  string $value
  * @return string
  * @throws Exception\RuntimeException
  */
 protected function _separatorToSeparatorFilter($value)
 {
     if ($this->searchSeparator == null) {
         throw new Exception\RuntimeException('You must provide a search separator for this filter to work.');
     }
     $this->setPattern('#' . preg_quote($this->searchSeparator, '#') . '#');
     $this->setReplacement($this->replacementSeparator);
     return parent::filter($value);
 }
コード例 #4
0
ファイル: PregReplaceTest.php プロジェクト: rexmac/zf2
 public function testPassingReplacementToConstructorSetsReplacement()
 {
     $replace = 'foo/bar';
     $filter = new PregReplaceFilter(null, $replace);
     $this->assertEquals($replace, $filter->getReplacement());
 }