From 47277726377a5614ebf4636b0b93682b719cc6e1 Mon Sep 17 00:00:00 2001 From: t0mmie Date: Fri, 7 May 2021 14:19:05 +0200 Subject: [PATCH] Check result of file touch --- .../Naneau/ProjectVersioner/Test/Reader/FinderTest.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tests/Naneau/ProjectVersioner/Test/Reader/FinderTest.php b/tests/Naneau/ProjectVersioner/Test/Reader/FinderTest.php index 92fb486..211edcc 100644 --- a/tests/Naneau/ProjectVersioner/Test/Reader/FinderTest.php +++ b/tests/Naneau/ProjectVersioner/Test/Reader/FinderTest.php @@ -6,6 +6,7 @@ use Naneau\ProjectVersioner\Reader\Finder\Contents as ContentsReader; use Symfony\Component\Finder\Finder; +use Exception; class FinderTest extends \PHPUnit\Framework\TestCase { @@ -62,8 +63,13 @@ public function testEmptyNamesWithFinder(): void $timeThree = time(); $timeFour = $timeThree - 10; - touch($directory . '/DirectoryOne/FileThree.php', $timeThree); - touch($directory . '/DirectoryOne/FileFour.txt', $timeFour); + if (!touch($directory . '/DirectoryOne/FileThree.php', $timeThree)) { + throw new Exception('Failed to update touch time to ' . $timeThree . ' for file "FileThree.php"'); + } + + if (!touch($directory . '/DirectoryOne/FileFour.txt', $timeFour)) { + throw new Exception('Failed to update touch time to ' . $timeFour . ' for file "FileFour.txt"'); + } self::assertEquals($timeThree, $versionerPhp->get($directory)); self::assertEquals($timeFour, $versionerTxt->get($directory));