save($file); self::assertFileExists($file); unlink($file); } /** * Test construct exception. */ public function testConstructException(): void { $this->expectException(\PhpOffice\PhpWord\Exception\Exception::class); $this->expectExceptionMessage('PDF rendering library or library path has not been defined.'); $writer = new PDF(new PhpWord()); $writer->save(); } }