assertTrue($object->canRead($filename)); } /** * Can read exception */ public function testCanReadFailed() { $object = new Word2007(); $filename = __DIR__ . '/../_files/documents/foo.docx'; $this->assertFalse($object->canRead($filename)); } /** * Load */ public function testLoad() { $filename = __DIR__ . '/../_files/documents/reader.docx'; $phpWord = IOFactory::load($filename); $this->assertInstanceOf('PhpOffice\\PhpWord\\PhpWord', $phpWord); $this->assertTrue($phpWord->getSettings()->hasDoNotTrackMoves()); $this->assertFalse($phpWord->getSettings()->hasDoNotTrackFormatting()); $this->assertEquals(100, $phpWord->getSettings()->getZoom()); $doc = TestHelperDOCX::getDocument($phpWord); $this->assertEquals('0', $doc->getElementAttribute('/w:document/w:body/w:p/w:r[w:t/node()="italics"]/w:rPr/w:b', 'w:val')); } /** * Load a Word 2011 file */ public function testLoadWord2011() { $filename = __DIR__ . '/../_files/documents/reader-2011.docx'; $phpWord = IOFactory::load($filename); $this->assertInstanceOf('PhpOffice\\PhpWord\\PhpWord', $phpWord); $doc = TestHelperDOCX::getDocument($phpWord); $this->assertTrue($doc->elementExists('/w:document/w:body/w:p[3]/w:r/w:pict/v:shape/v:imagedata')); } }