public function testText() { $object = new Run(); $this->assertEquals('', $object->getText()); $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\RichText\\Run', $object->setText()); $this->assertEquals('', $object->getText()); $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\RichText\\Run', $object->setText('AAA')); $this->assertEquals('AAA', $object->getText()); $object = new Run('BBB'); $this->assertEquals('BBB', $object->getText()); }
public function testTableWithText() { $oRun = new Run(); $oRun->setText('Test'); $phpPowerPoint = new PhpPowerpoint(); $oSlide = $phpPowerPoint->getActiveSlide(); $oShape = $oSlide->createTableShape(); $oRow = $oShape->createRow(); $oCell = $oRow->getCell(); $oCell->addText($oRun); $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'ODPresentation'); $element = '/office:document-content/office:body/office:presentation/draw:page/draw:frame/table:table/table:table-row/table:table-cell/text:p/text:span'; $this->assertTrue($pres->elementExists($element, 'content.xml')); $this->assertEquals('Test', $pres->getElement($element, 'content.xml')->nodeValue); }