/** * Perform a search and replace matches * * @return String * @author Dan Cox */ public function searchAndReplace() { $this->search(); $this->replacement = new Replacement($this->formatted, $this->str); $this->replacement->replace(); return $this->replacement->getStr(); }
/** * Test the replacing of masks in a string * * @return void * @author Dan Cox */ public function test_replaceFromText() { $string = 'this is a [mask]'; $string_no_mask = 'this is just a [string]'; $this->masks->addMask('mask', 'mask value'); $replaced = $this->masks->replace($string); $replaced_2 = $this->masks->replace($string_no_mask); $this->assertEquals('this is a mask value', $replaced); $this->assertEquals('this is just a [string]', $replaced_2); }