Esempio n. 1
0
 /**
  * @group UsingDB
  */
 function testParseOneLine()
 {
     $model = new NavigationModel();
     $cases = array();
     $cases[] = array('line' => "*whatever", 'out' => array('original' => 'whatever', 'text' => 'whatever', 'href' => Title::newFromText('whatever')->fixSpecialName()->getLocalURL(), 'specialAttr' => null));
     $cases[] = array('line' => "*********whatever", 'out' => array('original' => 'whatever', 'text' => 'whatever', 'href' => Title::newFromText('whatever')->fixSpecialName()->getLocalURL(), 'specialAttr' => null));
     $cases[] = array('line' => "*whatever|something", 'out' => array('original' => 'whatever', 'text' => 'something', 'href' => Title::newFromText('whatever')->fixSpecialName()->getLocalURL(), 'specialAttr' => null));
     $cases[] = array('line' => "*http://www.google.com", 'out' => array('original' => 'http://www.google.com', 'text' => 'http://www.google.com', 'href' => 'http://www.google.com', 'specialAttr' => null));
     $cases[] = array('line' => "*http://www.google.com|Google", 'out' => array('original' => 'http://www.google.com', 'text' => 'Google', 'href' => 'http://www.google.com', 'specialAttr' => null));
     $cases[] = array('line' => "*#|Google", 'out' => array('original' => '#', 'text' => 'Google', 'href' => '#', 'specialAttr' => null));
     $cases[] = array('line' => "*|Google", 'out' => array('original' => '', 'text' => 'Google', 'href' => '#', 'specialAttr' => null));
     $cases[] = array('line' => "*__NOLINK__edit", 'out' => array('original' => '__NOLINK__edit', 'text' => wfMsg('edit'), 'href' => '#', 'specialAttr' => null));
     $cases[] = array('line' => "*�|�", 'out' => array('original' => "�", 'text' => "�", 'href' => '#', 'specialAttr' => null));
     foreach ($cases as $case) {
         $this->assertEquals($case['out'], $model->parseOneLine($case['line']));
     }
 }