tempDir = $this->createTempDir( __CLASS__ . sprintf( '_%03d_', ++$i ) ) . '/'; $this->basePath = dirname( __FILE__ ) . '/files/pdf/'; } public function tearDown() { if ( !$this->hasFailed() ) { $this->removeTempDir(); } } /** * Assert that the given PDF document content is simlar to the * PDF document referenced by its test case name. * * @param string $content * @param string $name * @return void */ protected function assertPdfDocumentsSimilar( $content, $name ) { $baseName = str_replace( '::', '_', $name ) . '.pdf'; // Normalize dates in generated PDF $content = preg_replace( '(/(CreationDate|ModDate)\\s+\\(D:\\d+\\))', '\\1 (D:20000101010000)', $content ); // Store file for manual inspection if the test case fails file_put_contents( $this->tempDir . $baseName, $content ); $this->assertFileExists( $compare = $this->basePath . 'driver/' . $baseName ); $this->assertEquals( file_get_contents( $compare ), $content, 'Generated PDF document does not match expected document.' ); } } ?>