From d806f7c69a6500c9c3477ef5c65645db8dd90d8d Mon Sep 17 00:00:00 2001 From: Sam Wilson Date: Wed, 11 Sep 2024 11:46:55 +0800 Subject: [PATCH] Delete files created during tests Also remove the check for `tests/data/README.md` which doesn't exist. --- tests/integration/CompileTest.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/tests/integration/CompileTest.php b/tests/integration/CompileTest.php index 4899ecf..1a29c18 100644 --- a/tests/integration/CompileTest.php +++ b/tests/integration/CompileTest.php @@ -25,13 +25,10 @@ public function testDataFiles(): void $converter = new MarkdownConverter($environment); $markdownFiles = \glob(\dirname(__DIR__) . '/data/*.md'); foreach ($markdownFiles as $markdownFile) { - if (\basename($markdownFile) === 'README.md') { - continue; - } - $workingDir = \dirname($markdownFile); // Create a temp tex file in the tests directory, so it's got access to images etc. - $tmpTexFile = $workingDir . '/CompileTest_' . \pathinfo($markdownFile, PATHINFO_FILENAME) . '.tex'; + $prefix = $workingDir . '/CompileTest_'; + $tmpTexFile = $prefix . \pathinfo($markdownFile, PATHINFO_FILENAME) . '.tex'; $markdown = \file_get_contents($markdownFile); $latex = "\\documentclass{article}\n" . "\\usepackage{listings, graphicx, hyperref, footmisc}\n" @@ -43,6 +40,8 @@ public function testDataFiles(): void $process->mustRun(); $this->assertStringContainsString('Output written', $process->getOutput()); $this->assertStringContainsString('1 page', $process->getOutput()); + // Delete temp files. + \array_map('unlink', \glob($prefix . '*')); } } }