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