From 933554098a6fe5fcb233f4c9716b074ba410f6a9 Mon Sep 17 00:00:00 2001 From: Justin Hileman Date: Mon, 3 Jul 2017 00:17:05 -0700 Subject: [PATCH] Improve prod filesystem loader test coverage. --- .../Loader/ProductionFilesystemLoaderTest.php | 21 ++++++++++++++++ .../Test/Source/FilesystemSourceTest.php | 25 +++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 test/Mustache/Test/Source/FilesystemSourceTest.php diff --git a/test/Mustache/Test/Loader/ProductionFilesystemLoaderTest.php b/test/Mustache/Test/Loader/ProductionFilesystemLoaderTest.php index afdb09e..0c7c7e3 100644 --- a/test/Mustache/Test/Loader/ProductionFilesystemLoaderTest.php +++ b/test/Mustache/Test/Loader/ProductionFilesystemLoaderTest.php @@ -79,4 +79,25 @@ class Mustache_Test_Loader_ProductionFilesystemLoaderTest extends PHPUnit_Framew $loader->load('fake'); } + + public function testLoadWithDifferentStatProps() + { + $baseDir = realpath(dirname(__FILE__) . '/../../../fixtures/templates'); + $noStatLoader = new Mustache_Loader_ProductionFilesystemLoader($baseDir, array('stat_props' => null)); + $mtimeLoader = new Mustache_Loader_ProductionFilesystemLoader($baseDir, array('stat_props' => array('mtime'))); + $sizeLoader = new Mustache_Loader_ProductionFilesystemLoader($baseDir, array('stat_props' => array('size'))); + $bothLoader = new Mustache_Loader_ProductionFilesystemLoader($baseDir, array('stat_props' => array('mtime', 'size'))); + + $noStatKey = $noStatLoader->load('one.mustache')->getKey(); + $mtimeKey = $mtimeLoader->load('one.mustache')->getKey(); + $sizeKey = $sizeLoader->load('one.mustache')->getKey(); + $bothKey = $bothLoader->load('one.mustache')->getKey(); + + $this->assertNotEquals($noStatKey, $mtimeKey); + $this->assertNotEquals($noStatKey, $sizeKey); + $this->assertNotEquals($noStatKey, $bothKey); + $this->assertNotEquals($mtimeKey, $sizeKey); + $this->assertNotEquals($mtimeKey, $bothKey); + $this->assertNotEquals($sizeKey, $bothKey); + } } diff --git a/test/Mustache/Test/Source/FilesystemSourceTest.php b/test/Mustache/Test/Source/FilesystemSourceTest.php new file mode 100644 index 0000000..a636ffe --- /dev/null +++ b/test/Mustache/Test/Source/FilesystemSourceTest.php @@ -0,0 +1,25 @@ +getKey(); + } +}