Skip to content

Commit 0cd034b

Browse files
committed
Fix CI: move test fixture to avoid lint-guides-xml and data provider conflicts
1 parent 43e0acb commit 0cd034b

File tree

3 files changed

+27
-5
lines changed

3 files changed

+27
-5
lines changed

tests/Integration/InvalidGuidesXmlTest.php

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,32 @@
99

1010
/**
1111
* Tests error handling for invalid guides.xml configurations.
12+
*
13+
* The fixture is stored as guides.xml.fixture to avoid being picked up by lint-guides-xml.
14+
* Tests copy it to a temp directory with the correct name before execution.
1215
*/
1316
final class InvalidGuidesXmlTest extends TestCase
1417
{
15-
private const FIXTURES_PATH = __DIR__ . '/tests/invalid-guides-xml/input';
18+
private const FIXTURE_SOURCE = __DIR__ . '/../fixtures/invalid-guides-xml';
19+
20+
private string $tempDir = '';
21+
22+
protected function setUp(): void
23+
{
24+
$this->tempDir = sys_get_temp_dir() . '/render-guides-invalid-test-' . uniqid();
25+
mkdir($this->tempDir, 0755, true);
26+
27+
// Copy fixture files to temp directory
28+
copy(self::FIXTURE_SOURCE . '/guides.xml.fixture', $this->tempDir . '/guides.xml');
29+
copy(self::FIXTURE_SOURCE . '/Index.rst', $this->tempDir . '/Index.rst');
30+
}
31+
32+
protected function tearDown(): void
33+
{
34+
if (is_dir($this->tempDir)) {
35+
system('rm -rf ' . escapeshellarg($this->tempDir));
36+
}
37+
}
1638

1739
public function testInvalidGuidesXmlShowsHelpfulErrorMessage(): void
1840
{
@@ -22,8 +44,8 @@ public function testInvalidGuidesXmlShowsHelpfulErrorMessage(): void
2244
'php',
2345
$binPath,
2446
'run',
25-
'--config=' . self::FIXTURES_PATH,
26-
self::FIXTURES_PATH,
47+
'--config=' . $this->tempDir,
48+
$this->tempDir,
2749
]);
2850

2951
$process->run();
@@ -50,8 +72,8 @@ public function testInvalidGuidesXmlShowsLineNumber(): void
5072
'php',
5173
$binPath,
5274
'run',
53-
'--config=' . self::FIXTURES_PATH,
54-
self::FIXTURES_PATH,
75+
'--config=' . $this->tempDir,
76+
$this->tempDir,
5577
]);
5678

5779
$process->run();
File renamed without changes.

tests/Integration/tests/invalid-guides-xml/input/guides.xml renamed to tests/fixtures/invalid-guides-xml/guides.xml.fixture

File renamed without changes.

0 commit comments

Comments
 (0)