save($file); $this->assertFileExists($file); unlink($file); } /** * Test construct exception */ public function testConstructException() { $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(); } }