Skip to content

Commit

Permalink
Check result of file touch
Browse files Browse the repository at this point in the history
  • Loading branch information
t0mmie committed May 7, 2021
1 parent 503d4ac commit 4727772
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions tests/Naneau/ProjectVersioner/Test/Reader/FinderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down Expand Up @@ -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));
Expand Down

0 comments on commit 4727772

Please sign in to comment.