addText() public method

Add text
public addText ( PhpOffice\PhpPresentation\Shape\RichText\TextElementInterface $pText = null ) : RichText
$pText PhpOffice\PhpPresentation\Shape\RichText\TextElementInterface Rich text element
return RichText
Ejemplo n.º 1
0
 public function testText()
 {
     $object = new RichText();
     $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText', $object->addText());
     $this->assertCount(1, $object->getActiveParagraph()->getRichTextElements());
     $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText', $object->addText(new TextElement()));
     $this->assertCount(2, $object->getActiveParagraph()->getRichTextElements());
     $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\TextElement', $object->createText());
     $this->assertCount(3, $object->getActiveParagraph()->getRichTextElements());
     $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\TextElement', $object->createText('ALPHA'));
     $this->assertCount(4, $object->getActiveParagraph()->getRichTextElements());
     $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\BreakElement', $object->createBreak());
     $this->assertCount(5, $object->getActiveParagraph()->getRichTextElements());
     $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Run', $object->createTextRun());
     $this->assertCount(6, $object->getActiveParagraph()->getRichTextElements());
     $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\RichText\\Run', $object->createTextRun('BETA'));
     $this->assertCount(7, $object->getActiveParagraph()->getRichTextElements());
     $this->assertEquals('ALPHA' . "\r\n" . 'BETA', $object->getPlainText());
     $this->assertEquals('ALPHA' . "\r\n" . 'BETA', (string) $object);
 }