Blame view

export/PHPRtfLite-1.3.1/tests/PHPRtfLite/Element/HyperlinkTest.php 971 Bytes
f90e19c3   Andrea Petta   plugin update
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
  <?php
  
  /**
   * Test class for PHPRtfLite_Element_Hyperlink
   */
  class PHPRtfLite_Element_HyperlinkTest extends PHPUnit_Framework_TestCase
  {
  
      /**
       * @var PHPRtfLite
       */
      protected $_rtf;
  
      /**
       * Sets up the fixture, for example, opens a network connection.
       * This method is called before a test is executed.
       */
      protected function setUp()
      {
          $this->_rtf = new PHPRtfLite();
          $writer = new PHPRtfLite_Writer_String();
          $this->_rtf->setWriter($writer);
      }
  
      /**
       * tests render().
       */
      public function testRender()
      {
          $hyperlink = new PHPRtfLite_Element_Hyperlink($this->_rtf, 'My link text!');
          $hyperlink->setHyperlink('http://www.phprtf.com/');
          $hyperlink->render();
          $expected = '{\field {\*\fldinst {HYPERLINK "http://www.phprtf.com/"}}{\fldrslt {My link text!}}}';
          $this->assertEquals($expected, trim($this->_rtf->getWriter()->getContent()));
      }
  
  }