Пример #1
0
 /**
  * Add link with name
  */
 public function testAddLinkWithName()
 {
     $oTextRun = new TextRun();
     $element = $oTextRun->addLink('https://github.com/PHPOffice/PHPWord', htmlspecialchars('PHPWord on GitHub', ENT_COMPAT, 'UTF-8'));
     $this->assertInstanceOf('PhpOffice\\PhpWord\\Element\\Link', $element);
     $this->assertCount(1, $oTextRun->getElements());
     $this->assertEquals('https://github.com/PHPOffice/PHPWord', $element->getSource());
     $this->assertEquals(htmlspecialchars('PHPWord on GitHub', ENT_COMPAT, 'UTF-8'), $element->getText());
 }
Пример #2
0
 /**
  * Add link with name
  */
 public function testAddLinkWithName()
 {
     $oTextRun = new TextRun();
     $element = $oTextRun->addLink('http://www.google.fr', utf8_decode('ééé'));
     $this->assertInstanceOf('PhpOffice\\PhpWord\\Element\\Link', $element);
     $this->assertCount(1, $oTextRun->getElements());
     $this->assertEquals($element->getTarget(), 'http://www.google.fr');
     $this->assertEquals($element->getText(), 'ééé');
 }