Esempio n. 1
0
 public function setText(Text $text)
 {
     if ($this->text !== $text) {
         $oldText = $this->text;
         if ($oldText) {
             $oldText->removeLinePart($this);
         }
         $this->text = $text;
         $text->addLinePart($this);
     }
 }
Esempio n. 2
0
 /**
  * @test
  */
 public function removeLinePart()
 {
     $text = new Text();
     $linePart1 = $this->getMockBuilder('PHPPdf\\Core\\Node\\Paragraph\\LinePart')->disableOriginalConstructor()->getMock();
     $linePart2 = $this->getMockBuilder('PHPPdf\\Core\\Node\\Paragraph\\LinePart')->disableOriginalConstructor()->getMock();
     $text->addLinePart($linePart1);
     $text->addLinePart($linePart2);
     $this->assertEquals(2, count($text->getLineParts()));
     $text->removeLinePart($linePart1);
     $this->assertEquals(1, count($text->getLineParts()));
     $text->removeLinePart($linePart1);
     $this->assertEquals(1, count($text->getLineParts()));
 }