public function NormalizeTest::testNormalizeMethodNormalizesWithArrayOfPatterns in Bibliography Module 7.2
File
- lib/
msrc-authortool/ tests/ NormalizeTest.php, line 154
Class
Code
public function testNormalizeMethodNormalizesWithArrayOfPatterns() {
$obj = new \Nametools\Normalize(new NormalizerTestMatchObject(), new \Nametools\RegexCounter());
$obj
->addPattern("/^EMAIL:(.+?)::NAME:(.+?)\$/", array(
'email',
'name',
));
$obj
->addPattern("/^(.+?)\\s(.+?)\$/", array(
'name',
'email',
));
$toMatch = new \NormalizerTestMatchObject();
$toMatch->name = "John";
$toMatch->email = "john@example.com";
$result = $obj
->normalize("John john@example.com");
$this
->assertEquals($toMatch, $result);
$result = $obj
->normalize("EMAIL:john@example.com::NAME:John");
$this
->assertEquals($toMatch, $result);
}