From 297f4a276a600b50b247b8aba7933bbbe1afb01a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20FAMIBELLE-PRONZOLA?= Date: Mon, 27 Jul 2026 22:11:10 +0400 Subject: [PATCH] test: make dons-sync tests work without dons.php instance copy --- tests/php/dons-sync-test.php | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/tests/php/dons-sync-test.php b/tests/php/dons-sync-test.php index 72672bc..efc04fd 100644 --- a/tests/php/dons-sync-test.php +++ b/tests/php/dons-sync-test.php @@ -14,7 +14,16 @@ $root = dirname(__DIR__, 2); // --- Synchronisation dons.php / dons.php.sample ----------------------------- -$donsLive = file_get_contents($root . '/dons.php'); +// dons.php est une copie d'instance ignorée par git : dans le CI elle est +// absente, on la crée depuis le .sample pour les tests et on la nettoie après. +$donsLivePath = $root . '/dons.php'; +$donsLiveCreated = false; +if (!file_exists($donsLivePath)) { + copy($root . '/dons.php.sample', $donsLivePath); + $donsLiveCreated = true; +} + +$donsLive = file_get_contents($donsLivePath); $donsSample = file_get_contents($root . '/dons.php.sample'); assertContains( @@ -206,3 +215,7 @@ foreach ($phpErrorNeedles as $needle) { foreach ($createdCopies as $copyPath) { unlink($copyPath); } + +if ($donsLiveCreated) { + unlink($donsLivePath); +}