assertTrue($object->canRead($filename)); } /** * Can read exception */ public function testCanReadFailed() { $object = new MsDoc(); $filename = __DIR__ . '/../_files/documents/foo.doc'; $this->assertFalse($object->canRead($filename)); } /** * Load */ public function testLoad() { $filename = __DIR__ . '/../_files/documents/reader.doc'; $phpWord = IOFactory::load($filename, 'MsDoc'); $this->assertInstanceOf('PhpOffice\\PhpWord\\PhpWord', $phpWord); } /** * Test exception on not existing file * @expectedException \Exception */ public function testFailIfFileNotReadable() { $filename = __DIR__ . '/../_files/documents/not_existing_reader.doc'; IOFactory::load($filename, 'MsDoc'); } /** * Test exception on non OLE document * @expectedException \Exception */ public function testFailIfFileNotOle() { $filename = __DIR__ . '/../_files/documents/reader.odt'; IOFactory::load($filename, 'MsDoc'); } }