diff --git a/.travis.yml b/.travis.yml index e68b99c6..99de817a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,15 +1,21 @@ language: php -php: - - 5.2 - - 5.3 - - 5.4 - - 5.5 - - 5.6 - - 7.0 - - hhvm +sudo: false + +matrix: + include: + - php: 5.2 + - php: 5.3 + - php: 5.4 + - php: 5.5 + - php: 5.6 + - php: 7.0 + - php: 7.1 + - php: hhvm + dist: trusty script: - - phpunit + - '[[ "$TRAVIS_PHP_VERSION" = 5.2* ]] && phpunit || vendor/bin/phpunit --verbose' -sudo: false +install: + - '[[ "$TRAVIS_PHP_VERSION" = 5.2* ]] || composer install' diff --git a/src/Mustache/Autoloader.php b/src/Mustache/Autoloader.php index b16ac142..e8ea3f4a 100644 --- a/src/Mustache/Autoloader.php +++ b/src/Mustache/Autoloader.php @@ -3,7 +3,7 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2016 Justin Hileman + * (c) 2010-2017 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -16,6 +16,14 @@ class Mustache_Autoloader { private $baseDir; + /** + * An array where the key is the baseDir and the key is an instance of this + * class. + * + * @var array + */ + private static $instances; + /** * Autoloader constructor. * @@ -45,7 +53,13 @@ public function __construct($baseDir = null) */ public static function register($baseDir = null) { - $loader = new self($baseDir); + $key = $baseDir ? $baseDir : 0; + + if (!isset(self::$instances[$key])) { + self::$instances[$key] = new self($baseDir); + } + + $loader = self::$instances[$key]; spl_autoload_register(array($loader, 'autoload')); return $loader; diff --git a/src/Mustache/Cache.php b/src/Mustache/Cache.php index 7b465abd..3b5b3f1b 100644 --- a/src/Mustache/Cache.php +++ b/src/Mustache/Cache.php @@ -3,7 +3,7 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2016 Justin Hileman + * (c) 2010-2017 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/src/Mustache/Cache/AbstractCache.php b/src/Mustache/Cache/AbstractCache.php index 495090b6..365eafac 100644 --- a/src/Mustache/Cache/AbstractCache.php +++ b/src/Mustache/Cache/AbstractCache.php @@ -3,7 +3,7 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2016 Justin Hileman + * (c) 2010-2017 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/src/Mustache/Cache/FilesystemCache.php b/src/Mustache/Cache/FilesystemCache.php index 0dbe8f9d..3e742b70 100644 --- a/src/Mustache/Cache/FilesystemCache.php +++ b/src/Mustache/Cache/FilesystemCache.php @@ -3,7 +3,7 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2016 Justin Hileman + * (c) 2010-2017 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -108,9 +108,11 @@ private function buildDirectoryForFilename($fileName) ); @mkdir($dirName, 0777, true); + // @codeCoverageIgnoreStart if (!is_dir($dirName)) { throw new Mustache_Exception_RuntimeException(sprintf('Failed to create cache directory "%s".', $dirName)); } + // @codeCoverageIgnoreEnd } return $dirName; @@ -143,13 +145,17 @@ private function writeFile($fileName, $value) return; } + // @codeCoverageIgnoreStart $this->log( Mustache_Logger::ERROR, 'Unable to rename Mustache temp cache file: "{tempName}" -> "{fileName}"', array('tempName' => $tempFile, 'fileName' => $fileName) ); + // @codeCoverageIgnoreEnd } + // @codeCoverageIgnoreStart throw new Mustache_Exception_RuntimeException(sprintf('Failed to write cache file "%s".', $fileName)); + // @codeCoverageIgnoreEnd } } diff --git a/src/Mustache/Cache/NoopCache.php b/src/Mustache/Cache/NoopCache.php index ca0007de..ed9eec9d 100644 --- a/src/Mustache/Cache/NoopCache.php +++ b/src/Mustache/Cache/NoopCache.php @@ -3,7 +3,7 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2016 Justin Hileman + * (c) 2010-2017 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/src/Mustache/Compiler.php b/src/Mustache/Compiler.php index 2a831d6e..610369ed 100644 --- a/src/Mustache/Compiler.php +++ b/src/Mustache/Compiler.php @@ -3,7 +3,7 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2016 Justin Hileman + * (c) 2010-2017 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -191,7 +191,6 @@ public function renderInternal(Mustache_Context $context, $indent = \'\') { $this->lambdaHelper = new Mustache_LambdaHelper($this->mustache, $context); $buffer = \'\'; - $blocksContext = array(); %s return $buffer; @@ -207,7 +206,6 @@ class %s extends Mustache_Template public function renderInternal(Mustache_Context $context, $indent = \'\') { $buffer = \'\'; - $blocksContext = array(); %s return $buffer; @@ -240,10 +238,11 @@ private function writeCode($tree, $name) $blockFunction = $context->findInBlock(%s); if (is_callable($blockFunction)) { $buffer .= call_user_func($blockFunction, $context); - } else {%s - } + %s} '; + const BLOCK_VAR_ELSE = '} else {%s'; + /** * Generate Mustache Template inheritance block variable PHP source. * @@ -261,10 +260,15 @@ private function blockVar($nodes, $id, $start, $end, $otag, $ctag, $level) { $id = var_export($id, true); - return sprintf($this->prepare(self::BLOCK_VAR, $level), $id, $this->walk($nodes, $level)); + $else = $this->walk($nodes, $level); + if ($else !== '') { + $else = sprintf($this->prepare(self::BLOCK_VAR_ELSE, $level + 1, false, true), $else); + } + + return sprintf($this->prepare(self::BLOCK_VAR, $level), $id, $else); } - const BLOCK_ARG = '$blocksContext[%s] = array($this, \'block%s\');'; + const BLOCK_ARG = '%s => array($this, \'block%s\'),'; /** * Generate Mustache Template inheritance block argument PHP source. @@ -285,14 +289,13 @@ private function blockArg($nodes, $id, $start, $end, $otag, $ctag, $level) $keystr = var_export($key, true); $id = var_export($id, true); - return sprintf($this->prepare(self::BLOCK_ARG, 1), $id, $key); + return sprintf($this->prepare(self::BLOCK_ARG, $level), $id, $key); } const BLOCK_FUNCTION = ' public function block%s($context) { - $indent = $buffer = \'\'; - $blocksContext = array();%s + $indent = $buffer = \'\';%s return $buffer; } @@ -327,7 +330,6 @@ private function block($nodes) private function section%s(Mustache_Context $context, $indent, $value) { $buffer = \'\'; - $blocksContext = array(); if (%s) { $source = %s; @@ -363,11 +365,10 @@ private function section%s(Mustache_Context $context, $indent, $value) * @param string $otag Current Mustache opening tag * @param string $ctag Current Mustache closing tag * @param int $level - * @param bool $arg (default: false) * * @return string Generated section PHP source code */ - private function section($nodes, $id, $filters, $start, $end, $otag, $ctag, $level, $arg = false) + private function section($nodes, $id, $filters, $start, $end, $otag, $ctag, $level) { $source = var_export(substr($this->source, $start, $end - $start), true); $callable = $this->getCallable(); @@ -387,15 +388,11 @@ private function section($nodes, $id, $filters, $start, $end, $otag, $ctag, $lev $this->sections[$key] = sprintf($this->prepare(self::SECTION), $key, $callable, $source, $helper, $delims, $this->walk($nodes, 2)); } - if ($arg === true) { - return $key; - } else { - $method = $this->getFindMethod($id); - $id = var_export($id, true); - $filters = $this->getFilters($filters, $level); + $method = $this->getFindMethod($id); + $id = var_export($id, true); + $filters = $this->getFilters($filters, $level); - return sprintf($this->prepare(self::SECTION_CALL, $level), $id, $method, $id, $filters, $key); - } + return sprintf($this->prepare(self::SECTION_CALL, $level), $id, $method, $id, $filters, $key); } const INVERTED_SECTION = ' @@ -457,15 +454,20 @@ private function partial($id, $indent, $level) } const PARENT = ' - %s - if ($parent = $this->mustache->loadPartial(%s)) { - $context->pushBlockContext($blocksContext); + $context->pushBlockContext(array(%s + )); $buffer .= $parent->renderInternal($context, $indent); $context->popBlockContext(); } '; + const PARENT_NO_CONTEXT = ' + if ($parent = $this->mustache->loadPartial(%s)) { + $buffer .= $parent->renderInternal($context, $indent); + } + '; + /** * Generate Mustache Template inheritance parent call PHP source. * @@ -480,11 +482,14 @@ private function parent($id, $indent, array $children, $level) { $realChildren = array_filter($children, array(__CLASS__, 'onlyBlockArgs')); + if (empty($realChildren)) { + return sprintf($this->prepare(self::PARENT_NO_CONTEXT, $level), var_export($id, true)); + } + return sprintf( $this->prepare(self::PARENT, $level), - $this->walk($realChildren, $level), var_export($id, true), - var_export($indent, true) + $this->walk($realChildren, $level + 1) ); } @@ -621,7 +626,7 @@ private function getEscape($value = '$value') /** * Select the appropriate Context `find` method for a given $id. * - * The return value will be one of `find`, `findDot` or `last`. + * The return value will be one of `find`, `findDot`, `findAnchoredDot` or `last`. * * @see Mustache_Context::find * @see Mustache_Context::findDot diff --git a/src/Mustache/Context.php b/src/Mustache/Context.php index f59faea8..69c02e01 100644 --- a/src/Mustache/Context.php +++ b/src/Mustache/Context.php @@ -3,7 +3,7 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2016 Justin Hileman + * (c) 2010-2017 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/src/Mustache/Engine.php b/src/Mustache/Engine.php index 856d4efe..91109771 100644 --- a/src/Mustache/Engine.php +++ b/src/Mustache/Engine.php @@ -3,7 +3,7 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2016 Justin Hileman + * (c) 2010-2017 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -23,7 +23,7 @@ */ class Mustache_Engine { - const VERSION = '2.11.1'; + const VERSION = '2.12.0'; const SPEC_VERSION = '1.1.2'; const PRAGMA_FILTERS = 'FILTERS'; @@ -54,6 +54,7 @@ class Mustache_Engine private $logger; private $strictCallables = false; private $pragmas = array(); + private $delimiters; // Services private $tokenizer; @@ -81,6 +82,14 @@ class Mustache_Engine * // sections are often too dynamic to benefit from caching. * 'cache_lambda_templates' => true, * + * // Customize the tag delimiters used by this engine instance. Note that overriding here changes the + * // delimiters used to parse all templates and partials loaded by this instance. To override just for a + * // single template, use an inline "change delimiters" tag at the start of the template file: + * // + * // {{=<% %>=}} + * // + * 'delimiters' => '<% %>', + * * // A Mustache template loader instance. Uses a StringLoader if not specified. * 'loader' => new Mustache_Loader_FilesystemLoader(dirname(__FILE__).'/views'), * @@ -133,6 +142,10 @@ class Mustache_Engine public function __construct(array $options = array()) { if (isset($options['template_class_prefix'])) { + if ((string) $options['template_class_prefix'] === '') { + throw new Mustache_Exception_InvalidArgumentException('Mustache Constructor "template_class_prefix" must not be empty'); + } + $this->templateClassPrefix = $options['template_class_prefix']; } @@ -191,6 +204,10 @@ public function __construct(array $options = array()) $this->strictCallables = $options['strict_callables']; } + if (isset($options['delimiters'])) { + $this->delimiters = $options['delimiters']; + } + if (isset($options['pragmas'])) { foreach ($options['pragmas'] as $pragma) { if (!isset(self::$knownPragmas[$pragma])) { @@ -589,22 +606,43 @@ protected function getLambdaCache() /** * Helper method to generate a Mustache template class. * - * @param string $source + * This method must be updated any time options are added which make it so + * the same template could be parsed and compiled multiple different ways. + * + * @param string|Mustache_Source $source * * @return string Mustache Template class name */ public function getTemplateClassName($source) { - return $this->templateClassPrefix . md5(sprintf( - 'version:%s,escape:%s,entity_flags:%i,charset:%s,strict_callables:%s,pragmas:%s,source:%s', - self::VERSION, - isset($this->escape) ? 'custom' : 'default', - $this->entityFlags, - $this->charset, - $this->strictCallables ? 'true' : 'false', - implode(' ', $this->getPragmas()), - $source - )); + // For the most part, adding a new option here should do the trick. + // + // Pick a value here which is unique for each possible way the template + // could be compiled... but not necessarily unique per option value. See + // escape below, which only needs to differentiate between 'custom' and + // 'default' escapes. + // + // Keep this list in alphabetical order :) + $chunks = array( + 'charset' => $this->charset, + 'delimiters' => $this->delimiters ? $this->delimiters : '{{ }}', + 'entityFlags' => $this->entityFlags, + 'escape' => isset($this->escape) ? 'custom' : 'default', + 'key' => ($source instanceof Mustache_Source) ? $source->getKey() : 'source', + 'pragmas' => $this->getPragmas(), + 'strictCallables' => $this->strictCallables, + 'version' => self::VERSION, + ); + + $key = json_encode($chunks); + + // Template Source instances have already provided their own source key. For strings, just include the whole + // source string in the md5 hash. + if (!$source instanceof Mustache_Source) { + $key .= "\n" . $source; + } + + return $this->templateClassPrefix . md5($key); } /** @@ -681,8 +719,8 @@ public function loadLambda($source, $delims = null) * @see Mustache_Engine::loadPartial * @see Mustache_Engine::loadLambda * - * @param string $source - * @param Mustache_Cache $cache (default: null) + * @param string|Mustache_Source $source + * @param Mustache_Cache $cache (default: null) * * @return Mustache_Template */ @@ -725,7 +763,7 @@ private function loadSource($source, Mustache_Cache $cache = null) */ private function tokenize($source) { - return $this->getTokenizer()->scan($source); + return $this->getTokenizer()->scan($source, $this->delimiters); } /** @@ -750,13 +788,12 @@ private function parse($source) * * @see Mustache_Compiler::compile * - * @param string $source + * @param string|Mustache_Source $source * * @return string generated Mustache template class code */ private function compile($source) { - $tree = $this->parse($source); $name = $this->getTemplateClassName($source); $this->log( @@ -765,6 +802,11 @@ private function compile($source) array('className' => $name) ); + if ($source instanceof Mustache_Source) { + $source = $source->getSource(); + } + $tree = $this->parse($source); + $compiler = $this->getCompiler(); $compiler->setPragmas($this->getPragmas()); diff --git a/src/Mustache/Exception.php b/src/Mustache/Exception.php index 66bd6bd4..d4001a9b 100644 --- a/src/Mustache/Exception.php +++ b/src/Mustache/Exception.php @@ -3,7 +3,7 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2016 Justin Hileman + * (c) 2010-2017 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/src/Mustache/Exception/InvalidArgumentException.php b/src/Mustache/Exception/InvalidArgumentException.php index 46b200c6..becf2ed1 100644 --- a/src/Mustache/Exception/InvalidArgumentException.php +++ b/src/Mustache/Exception/InvalidArgumentException.php @@ -3,7 +3,7 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2016 Justin Hileman + * (c) 2010-2017 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/src/Mustache/Exception/LogicException.php b/src/Mustache/Exception/LogicException.php index 8e75e7e1..b2424d67 100644 --- a/src/Mustache/Exception/LogicException.php +++ b/src/Mustache/Exception/LogicException.php @@ -3,7 +3,7 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2016 Justin Hileman + * (c) 2010-2017 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/src/Mustache/Exception/RuntimeException.php b/src/Mustache/Exception/RuntimeException.php index 9a7b90b5..b6369f4b 100644 --- a/src/Mustache/Exception/RuntimeException.php +++ b/src/Mustache/Exception/RuntimeException.php @@ -3,7 +3,7 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2016 Justin Hileman + * (c) 2010-2017 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/src/Mustache/Exception/SyntaxException.php b/src/Mustache/Exception/SyntaxException.php index 4fcb39d7..b1879a3d 100644 --- a/src/Mustache/Exception/SyntaxException.php +++ b/src/Mustache/Exception/SyntaxException.php @@ -3,7 +3,7 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2016 Justin Hileman + * (c) 2010-2017 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -27,7 +27,7 @@ public function __construct($msg, array $token, Exception $previous = null) if (version_compare(PHP_VERSION, '5.3.0', '>=')) { parent::__construct($msg, 0, $previous); } else { - parent::__construct($msg); + parent::__construct($msg); // @codeCoverageIgnore } } diff --git a/src/Mustache/Exception/UnknownFilterException.php b/src/Mustache/Exception/UnknownFilterException.php index 44505e49..0651c173 100644 --- a/src/Mustache/Exception/UnknownFilterException.php +++ b/src/Mustache/Exception/UnknownFilterException.php @@ -3,7 +3,7 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2016 Justin Hileman + * (c) 2010-2017 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -27,7 +27,7 @@ public function __construct($filterName, Exception $previous = null) if (version_compare(PHP_VERSION, '5.3.0', '>=')) { parent::__construct($message, 0, $previous); } else { - parent::__construct($message); + parent::__construct($message); // @codeCoverageIgnore } } diff --git a/src/Mustache/Exception/UnknownHelperException.php b/src/Mustache/Exception/UnknownHelperException.php index e1bc4d2c..193be782 100644 --- a/src/Mustache/Exception/UnknownHelperException.php +++ b/src/Mustache/Exception/UnknownHelperException.php @@ -3,7 +3,7 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2016 Justin Hileman + * (c) 2010-2017 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -27,7 +27,7 @@ public function __construct($helperName, Exception $previous = null) if (version_compare(PHP_VERSION, '5.3.0', '>=')) { parent::__construct($message, 0, $previous); } else { - parent::__construct($message); + parent::__construct($message); // @codeCoverageIgnore } } diff --git a/src/Mustache/Exception/UnknownTemplateException.php b/src/Mustache/Exception/UnknownTemplateException.php index 0c377962..32a778a5 100644 --- a/src/Mustache/Exception/UnknownTemplateException.php +++ b/src/Mustache/Exception/UnknownTemplateException.php @@ -3,7 +3,7 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2016 Justin Hileman + * (c) 2010-2017 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -27,7 +27,7 @@ public function __construct($templateName, Exception $previous = null) if (version_compare(PHP_VERSION, '5.3.0', '>=')) { parent::__construct($message, 0, $previous); } else { - parent::__construct($message); + parent::__construct($message); // @codeCoverageIgnore } } diff --git a/src/Mustache/HelperCollection.php b/src/Mustache/HelperCollection.php index 86c56b78..5d8f73c1 100644 --- a/src/Mustache/HelperCollection.php +++ b/src/Mustache/HelperCollection.php @@ -3,7 +3,7 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2016 Justin Hileman + * (c) 2010-2017 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/src/Mustache/LambdaHelper.php b/src/Mustache/LambdaHelper.php index 1d203d5d..e93dbfa3 100644 --- a/src/Mustache/LambdaHelper.php +++ b/src/Mustache/LambdaHelper.php @@ -3,7 +3,7 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2016 Justin Hileman + * (c) 2010-2017 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/src/Mustache/Loader.php b/src/Mustache/Loader.php index c5e1a19a..23adba1a 100644 --- a/src/Mustache/Loader.php +++ b/src/Mustache/Loader.php @@ -3,7 +3,7 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2016 Justin Hileman + * (c) 2010-2017 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -21,7 +21,7 @@ interface Mustache_Loader * * @param string $name * - * @return string Mustache Template source + * @return string|Mustache_Source Mustache Template source */ public function load($name); } diff --git a/src/Mustache/Loader/ArrayLoader.php b/src/Mustache/Loader/ArrayLoader.php index c0d6a4d4..4276493a 100644 --- a/src/Mustache/Loader/ArrayLoader.php +++ b/src/Mustache/Loader/ArrayLoader.php @@ -3,7 +3,7 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2016 Justin Hileman + * (c) 2010-2017 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/src/Mustache/Loader/CascadingLoader.php b/src/Mustache/Loader/CascadingLoader.php index b4726bc7..3fb6353c 100644 --- a/src/Mustache/Loader/CascadingLoader.php +++ b/src/Mustache/Loader/CascadingLoader.php @@ -3,7 +3,7 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2016 Justin Hileman + * (c) 2010-2017 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/src/Mustache/Loader/FilesystemLoader.php b/src/Mustache/Loader/FilesystemLoader.php index a3137513..e366df70 100644 --- a/src/Mustache/Loader/FilesystemLoader.php +++ b/src/Mustache/Loader/FilesystemLoader.php @@ -3,7 +3,7 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2016 Justin Hileman + * (c) 2010-2017 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/src/Mustache/Loader/InlineLoader.php b/src/Mustache/Loader/InlineLoader.php index f6d4b179..ae297fec 100644 --- a/src/Mustache/Loader/InlineLoader.php +++ b/src/Mustache/Loader/InlineLoader.php @@ -3,7 +3,7 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2016 Justin Hileman + * (c) 2010-2017 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/src/Mustache/Loader/MutableLoader.php b/src/Mustache/Loader/MutableLoader.php index f228d907..57fe5be3 100644 --- a/src/Mustache/Loader/MutableLoader.php +++ b/src/Mustache/Loader/MutableLoader.php @@ -3,7 +3,7 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2016 Justin Hileman + * (c) 2010-2017 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/src/Mustache/Loader/ProductionFilesystemLoader.php b/src/Mustache/Loader/ProductionFilesystemLoader.php new file mode 100644 index 00000000..e7353327 --- /dev/null +++ b/src/Mustache/Loader/ProductionFilesystemLoader.php @@ -0,0 +1,86 @@ + '.ms', + * 'stat_props' => array('size', 'mtime'), + * ); + * + * Specifying 'stat_props' overrides the stat properties used to invalidate the template cache. By default, this + * uses 'mtime' and 'size', but this can be set to any of the properties supported by stat(): + * + * http://php.net/manual/en/function.stat.php + * + * You can also disable filesystem stat entirely: + * + * $options = array('stat_props' => null); + * + * But with great power comes great responsibility. Namely, if you disable stat-based cache invalidation, + * YOU MUST CLEAR THE TEMPLATE CACHE YOURSELF when your templates change. Make it part of your build or deploy + * process so you don't forget! + * + * @throws Mustache_Exception_RuntimeException if $baseDir does not exist. + * + * @param string $baseDir Base directory containing Mustache template files. + * @param array $options Array of Loader options (default: array()) + */ + public function __construct($baseDir, array $options = array()) + { + parent::__construct($baseDir, $options); + + if (array_key_exists('stat_props', $options)) { + if (empty($options['stat_props'])) { + $this->statProps = array(); + } else { + $this->statProps = $options['stat_props']; + } + } else { + $this->statProps = array('size', 'mtime'); + } + } + + /** + * Helper function for loading a Mustache file by name. + * + * @throws Mustache_Exception_UnknownTemplateException If a template file is not found. + * + * @param string $name + * + * @return Mustache_Source Mustache Template source + */ + protected function loadFile($name) + { + $fileName = $this->getFileName($name); + + if (!file_exists($fileName)) { + throw new Mustache_Exception_UnknownTemplateException($name); + } + + return new Mustache_Source_FilesystemSource($fileName, $this->statProps); + } +} diff --git a/src/Mustache/Loader/StringLoader.php b/src/Mustache/Loader/StringLoader.php index 79b616bf..7012c03b 100644 --- a/src/Mustache/Loader/StringLoader.php +++ b/src/Mustache/Loader/StringLoader.php @@ -3,7 +3,7 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2016 Justin Hileman + * (c) 2010-2017 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/src/Mustache/Logger.php b/src/Mustache/Logger.php index 324a7ce5..cb4037a2 100644 --- a/src/Mustache/Logger.php +++ b/src/Mustache/Logger.php @@ -3,7 +3,7 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2016 Justin Hileman + * (c) 2010-2017 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/src/Mustache/Logger/AbstractLogger.php b/src/Mustache/Logger/AbstractLogger.php index 64bdf663..a169f9c6 100644 --- a/src/Mustache/Logger/AbstractLogger.php +++ b/src/Mustache/Logger/AbstractLogger.php @@ -3,7 +3,7 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2016 Justin Hileman + * (c) 2010-2017 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/src/Mustache/Logger/StreamLogger.php b/src/Mustache/Logger/StreamLogger.php index efb32318..402a148e 100644 --- a/src/Mustache/Logger/StreamLogger.php +++ b/src/Mustache/Logger/StreamLogger.php @@ -3,7 +3,7 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2016 Justin Hileman + * (c) 2010-2017 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/src/Mustache/Parser.php b/src/Mustache/Parser.php index adefebdd..c36a84af 100644 --- a/src/Mustache/Parser.php +++ b/src/Mustache/Parser.php @@ -3,7 +3,7 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2016 Justin Hileman + * (c) 2010-2017 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/src/Mustache/Source.php b/src/Mustache/Source.php new file mode 100644 index 00000000..278c2cb3 --- /dev/null +++ b/src/Mustache/Source.php @@ -0,0 +1,40 @@ +fileName = $fileName; + $this->statProps = $statProps; + } + + /** + * Get the Source key (used to generate the compiled class name). + * + * @throws RuntimeException when a source file cannot be read + * + * @return string + */ + public function getKey() + { + $chunks = array( + 'fileName' => $this->fileName, + ); + + if (!empty($this->statProps)) { + if (!isset($this->stat)) { + $this->stat = @stat($this->fileName); + } + + if ($this->stat === false) { + throw new RuntimeException(sprintf('Failed to read source file "%s".', $this->fileName)); + } + + foreach ($this->statProps as $prop) { + $chunks[$prop] = $this->stat[$prop]; + } + } + + return json_encode($chunks); + } + + /** + * Get the template Source. + * + * @return string + */ + public function getSource() + { + return file_get_contents($this->fileName); + } +} diff --git a/src/Mustache/Template.php b/src/Mustache/Template.php index 2b7771c4..4de82393 100644 --- a/src/Mustache/Template.php +++ b/src/Mustache/Template.php @@ -3,7 +3,7 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2016 Justin Hileman + * (c) 2010-2017 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/src/Mustache/Tokenizer.php b/src/Mustache/Tokenizer.php index 27e4d05e..b1f3d738 100644 --- a/src/Mustache/Tokenizer.php +++ b/src/Mustache/Tokenizer.php @@ -3,7 +3,7 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2016 Justin Hileman + * (c) 2010-2017 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -91,11 +91,14 @@ public function scan($text, $delimiters = null) { // Setting mbstring.func_overload makes things *really* slow. // Let's do everyone a favor and scan this string as ASCII instead. + // + // @codeCoverageIgnoreStart $encoding = null; if (function_exists('mb_internal_encoding') && ini_get('mbstring.func_overload') & 2) { $encoding = mb_internal_encoding(); mb_internal_encoding('ASCII'); } + // @codeCoverageIgnoreEnd $this->reset(); @@ -202,9 +205,11 @@ public function scan($text, $delimiters = null) $this->flushBuffer(); // Restore the user's encoding... + // @codeCoverageIgnoreStart if ($encoding) { mb_internal_encoding($encoding); } + // @codeCoverageIgnoreEnd return $this->tokens; } diff --git a/test/Mustache/Test/AutoloaderTest.php b/test/Mustache/Test/AutoloaderTest.php index 40af5eec..c72effef 100644 --- a/test/Mustache/Test/AutoloaderTest.php +++ b/test/Mustache/Test/AutoloaderTest.php @@ -3,7 +3,7 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2016 Justin Hileman + * (c) 2010-2017 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -33,4 +33,19 @@ public function testAutoloader() $loader->autoload('\Mustache_Bar'); $this->assertTrue(class_exists('Mustache_Bar')); } + + /** + * Test that the autoloader won't register multiple times. + */ + public function testRegisterMultiple() + { + $numLoaders = count(spl_autoload_functions()); + + Mustache_Autoloader::register(); + Mustache_Autoloader::register(); + + $expectedNumLoaders = $numLoaders + 1; + + $this->assertCount($expectedNumLoaders, spl_autoload_functions()); + } } diff --git a/test/Mustache/Test/Cache/AbstractCacheTest.php b/test/Mustache/Test/Cache/AbstractCacheTest.php index d977388b..ac47e64f 100644 --- a/test/Mustache/Test/Cache/AbstractCacheTest.php +++ b/test/Mustache/Test/Cache/AbstractCacheTest.php @@ -3,7 +3,7 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2016 Justin Hileman + * (c) 2010-2017 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/test/Mustache/Test/Cache/FilesystemCacheTest.php b/test/Mustache/Test/Cache/FilesystemCacheTest.php index 2413125c..6bcc483d 100644 --- a/test/Mustache/Test/Cache/FilesystemCacheTest.php +++ b/test/Mustache/Test/Cache/FilesystemCacheTest.php @@ -3,7 +3,7 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2016 Justin Hileman + * (c) 2010-2017 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/test/Mustache/Test/CompilerTest.php b/test/Mustache/Test/CompilerTest.php index 725a82c2..6fd1986f 100644 --- a/test/Mustache/Test/CompilerTest.php +++ b/test/Mustache/Test/CompilerTest.php @@ -3,7 +3,7 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2016 Justin Hileman + * (c) 2010-2017 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/test/Mustache/Test/ContextTest.php b/test/Mustache/Test/ContextTest.php index 029c2ba8..447ea161 100644 --- a/test/Mustache/Test/ContextTest.php +++ b/test/Mustache/Test/ContextTest.php @@ -3,7 +3,7 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2016 Justin Hileman + * (c) 2010-2017 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/test/Mustache/Test/EngineTest.php b/test/Mustache/Test/EngineTest.php index e8743d78..3e4d193b 100644 --- a/test/Mustache/Test/EngineTest.php +++ b/test/Mustache/Test/EngineTest.php @@ -3,7 +3,7 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2016 Justin Hileman + * (c) 2010-2017 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -158,6 +158,16 @@ public function testWithoutLambdaCache() $this->assertNotSame($mustache->getCache(), $mustache->getProtectedLambdaCache()); } + /** + * @expectedException Mustache_Exception_InvalidArgumentException + */ + public function testEmptyTemplatePrefixThrowsException() + { + new Mustache_Engine(array( + 'template_class_prefix' => '', + )); + } + /** * @expectedException Mustache_Exception_InvalidArgumentException * @dataProvider getBadEscapers @@ -331,6 +341,15 @@ public function testUnknownPragmaThrowsException() )); } + public function testCompileFromMustacheSourceInstance() + { + $baseDir = realpath(dirname(__FILE__) . '/../../fixtures/templates'); + $mustache = new Mustache_Engine(array( + 'loader' => new Mustache_Loader_ProductionFilesystemLoader($baseDir), + )); + $this->assertEquals('one contents', $mustache->render('one')); + } + private function getLoggedMustache($level = Mustache_Logger::ERROR) { $name = tempnam(sys_get_temp_dir(), 'mustache-test'); @@ -340,6 +359,23 @@ private function getLoggedMustache($level = Mustache_Logger::ERROR) return array($name, $mustache); } + + public function testCustomDelimiters() + { + $mustache = new Mustache_Engine(array( + 'delimiters' => '[[ ]]', + 'partials' => array( + 'one' => '[[> two ]]', + 'two' => '[[ a ]]', + ), + )); + + $tpl = $mustache->loadTemplate('[[# a ]][[ b ]][[/a ]]'); + $this->assertEquals('c', $tpl->render(array('a' => true, 'b' => 'c'))); + + $tpl = $mustache->loadTemplate('[[> one ]]'); + $this->assertEquals('b', $tpl->render(array('a' => 'b'))); + } } class MustacheStub extends Mustache_Engine diff --git a/test/Mustache/Test/Exception/SyntaxExceptionTest.php b/test/Mustache/Test/Exception/SyntaxExceptionTest.php index 3f6b2e45..074dafcd 100644 --- a/test/Mustache/Test/Exception/SyntaxExceptionTest.php +++ b/test/Mustache/Test/Exception/SyntaxExceptionTest.php @@ -3,7 +3,7 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2016 Justin Hileman + * (c) 2010-2017 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/test/Mustache/Test/Exception/UnknownFilterExceptionTest.php b/test/Mustache/Test/Exception/UnknownFilterExceptionTest.php index 049c8426..6dbe25e3 100644 --- a/test/Mustache/Test/Exception/UnknownFilterExceptionTest.php +++ b/test/Mustache/Test/Exception/UnknownFilterExceptionTest.php @@ -3,7 +3,7 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2016 Justin Hileman + * (c) 2010-2017 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/test/Mustache/Test/Exception/UnknownHelperExceptionTest.php b/test/Mustache/Test/Exception/UnknownHelperExceptionTest.php index b1682cdc..5b1ccbb6 100644 --- a/test/Mustache/Test/Exception/UnknownHelperExceptionTest.php +++ b/test/Mustache/Test/Exception/UnknownHelperExceptionTest.php @@ -3,7 +3,7 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2016 Justin Hileman + * (c) 2010-2017 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/test/Mustache/Test/Exception/UnknownTemplateExceptionTest.php b/test/Mustache/Test/Exception/UnknownTemplateExceptionTest.php index 2452749b..b993bfa8 100644 --- a/test/Mustache/Test/Exception/UnknownTemplateExceptionTest.php +++ b/test/Mustache/Test/Exception/UnknownTemplateExceptionTest.php @@ -3,7 +3,7 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2016 Justin Hileman + * (c) 2010-2017 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/test/Mustache/Test/FiveThree/Functional/ClosureQuirksTest.php b/test/Mustache/Test/FiveThree/Functional/ClosureQuirksTest.php index c997a1d2..cc575a9d 100644 --- a/test/Mustache/Test/FiveThree/Functional/ClosureQuirksTest.php +++ b/test/Mustache/Test/FiveThree/Functional/ClosureQuirksTest.php @@ -3,7 +3,7 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2016 Justin Hileman + * (c) 2010-2017 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/test/Mustache/Test/FiveThree/Functional/EngineTest.php b/test/Mustache/Test/FiveThree/Functional/EngineTest.php index 3ed70c76..406473eb 100644 --- a/test/Mustache/Test/FiveThree/Functional/EngineTest.php +++ b/test/Mustache/Test/FiveThree/Functional/EngineTest.php @@ -3,7 +3,7 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2016 Justin Hileman + * (c) 2010-2017 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/test/Mustache/Test/FiveThree/Functional/FiltersTest.php b/test/Mustache/Test/FiveThree/Functional/FiltersTest.php index 7adc6638..16dec608 100644 --- a/test/Mustache/Test/FiveThree/Functional/FiltersTest.php +++ b/test/Mustache/Test/FiveThree/Functional/FiltersTest.php @@ -3,7 +3,7 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2016 Justin Hileman + * (c) 2010-2017 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/test/Mustache/Test/FiveThree/Functional/HigherOrderSectionsTest.php b/test/Mustache/Test/FiveThree/Functional/HigherOrderSectionsTest.php index f926fdf7..eb051504 100644 --- a/test/Mustache/Test/FiveThree/Functional/HigherOrderSectionsTest.php +++ b/test/Mustache/Test/FiveThree/Functional/HigherOrderSectionsTest.php @@ -3,7 +3,7 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2016 Justin Hileman + * (c) 2010-2017 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/test/Mustache/Test/FiveThree/Functional/LambdaHelperTest.php b/test/Mustache/Test/FiveThree/Functional/LambdaHelperTest.php index c67957e4..6fc5d400 100644 --- a/test/Mustache/Test/FiveThree/Functional/LambdaHelperTest.php +++ b/test/Mustache/Test/FiveThree/Functional/LambdaHelperTest.php @@ -3,7 +3,7 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2016 Justin Hileman + * (c) 2010-2017 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/test/Mustache/Test/FiveThree/Functional/MustacheSpecTest.php b/test/Mustache/Test/FiveThree/Functional/MustacheSpecTest.php index d72686d5..af3f982b 100644 --- a/test/Mustache/Test/FiveThree/Functional/MustacheSpecTest.php +++ b/test/Mustache/Test/FiveThree/Functional/MustacheSpecTest.php @@ -3,7 +3,7 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2016 Justin Hileman + * (c) 2010-2017 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/test/Mustache/Test/FiveThree/Functional/PartialLambdaIndentTest.php b/test/Mustache/Test/FiveThree/Functional/PartialLambdaIndentTest.php index 605003c2..1f9af7ca 100644 --- a/test/Mustache/Test/FiveThree/Functional/PartialLambdaIndentTest.php +++ b/test/Mustache/Test/FiveThree/Functional/PartialLambdaIndentTest.php @@ -3,7 +3,7 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2016 Justin Hileman + * (c) 2010-2017 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/test/Mustache/Test/FiveThree/Functional/StrictCallablesTest.php b/test/Mustache/Test/FiveThree/Functional/StrictCallablesTest.php index fc910727..2c01169e 100644 --- a/test/Mustache/Test/FiveThree/Functional/StrictCallablesTest.php +++ b/test/Mustache/Test/FiveThree/Functional/StrictCallablesTest.php @@ -3,7 +3,7 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2016 Justin Hileman + * (c) 2010-2017 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/test/Mustache/Test/Functional/CallTest.php b/test/Mustache/Test/Functional/CallTest.php index fddeacf2..681ec1bc 100644 --- a/test/Mustache/Test/Functional/CallTest.php +++ b/test/Mustache/Test/Functional/CallTest.php @@ -3,7 +3,7 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2016 Justin Hileman + * (c) 2010-2017 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/test/Mustache/Test/Functional/ExamplesTest.php b/test/Mustache/Test/Functional/ExamplesTest.php index d7ef51ac..ac883ea4 100644 --- a/test/Mustache/Test/Functional/ExamplesTest.php +++ b/test/Mustache/Test/Functional/ExamplesTest.php @@ -3,7 +3,7 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2016 Justin Hileman + * (c) 2010-2017 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/test/Mustache/Test/Functional/HigherOrderSectionsTest.php b/test/Mustache/Test/Functional/HigherOrderSectionsTest.php index e2f68b0b..14774cd2 100644 --- a/test/Mustache/Test/Functional/HigherOrderSectionsTest.php +++ b/test/Mustache/Test/Functional/HigherOrderSectionsTest.php @@ -3,7 +3,7 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2016 Justin Hileman + * (c) 2010-2017 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/test/Mustache/Test/Functional/InheritanceTest.php b/test/Mustache/Test/Functional/InheritanceTest.php index b39555f6..62437041 100644 --- a/test/Mustache/Test/Functional/InheritanceTest.php +++ b/test/Mustache/Test/Functional/InheritanceTest.php @@ -3,7 +3,7 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2016 Justin Hileman + * (c) 2010-2017 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -227,6 +227,23 @@ public function testOverriddenPartial() $this->assertEquals('test |override1 default| |override2 default|', $tpl->render($data)); } + public function testBlocksDoNotLeakBetweenPartials() + { + $partials = array( + 'partial' => '|{{$a}}A{{/a}} {{$b}}B{{/b}}|', + ); + + $this->mustache->setPartials($partials); + + $tpl = $this->mustache->loadTemplate( + 'test {{assertEquals('test |C B| |A D|', $tpl->render($data)); + } + public function testDataDoesNotOverrideBlock() { $partials = array( diff --git a/test/Mustache/Test/Functional/MustacheInjectionTest.php b/test/Mustache/Test/Functional/MustacheInjectionTest.php index d0bdb487..7a9d6acd 100644 --- a/test/Mustache/Test/Functional/MustacheInjectionTest.php +++ b/test/Mustache/Test/Functional/MustacheInjectionTest.php @@ -3,7 +3,7 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2016 Justin Hileman + * (c) 2010-2017 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/test/Mustache/Test/Functional/MustacheSpecTest.php b/test/Mustache/Test/Functional/MustacheSpecTest.php index 7ba0843e..6cde602e 100644 --- a/test/Mustache/Test/Functional/MustacheSpecTest.php +++ b/test/Mustache/Test/Functional/MustacheSpecTest.php @@ -3,7 +3,7 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2016 Justin Hileman + * (c) 2010-2017 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/test/Mustache/Test/Functional/NestedPartialIndentTest.php b/test/Mustache/Test/Functional/NestedPartialIndentTest.php index 673339c3..90af4d95 100644 --- a/test/Mustache/Test/Functional/NestedPartialIndentTest.php +++ b/test/Mustache/Test/Functional/NestedPartialIndentTest.php @@ -3,7 +3,7 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2016 Justin Hileman + * (c) 2010-2017 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/test/Mustache/Test/Functional/ObjectSectionTest.php b/test/Mustache/Test/Functional/ObjectSectionTest.php index 963b0f78..3cf01e18 100644 --- a/test/Mustache/Test/Functional/ObjectSectionTest.php +++ b/test/Mustache/Test/Functional/ObjectSectionTest.php @@ -3,7 +3,7 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2016 Justin Hileman + * (c) 2010-2017 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/test/Mustache/Test/FunctionalTestCase.php b/test/Mustache/Test/FunctionalTestCase.php index 59185d18..213b045e 100644 --- a/test/Mustache/Test/FunctionalTestCase.php +++ b/test/Mustache/Test/FunctionalTestCase.php @@ -3,7 +3,7 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2016 Justin Hileman + * (c) 2010-2017 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/test/Mustache/Test/HelperCollectionTest.php b/test/Mustache/Test/HelperCollectionTest.php index df64e97d..12dfb5cf 100644 --- a/test/Mustache/Test/HelperCollectionTest.php +++ b/test/Mustache/Test/HelperCollectionTest.php @@ -3,7 +3,7 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2016 Justin Hileman + * (c) 2010-2017 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/test/Mustache/Test/Loader/ArrayLoaderTest.php b/test/Mustache/Test/Loader/ArrayLoaderTest.php index 9960c9b7..1f309878 100644 --- a/test/Mustache/Test/Loader/ArrayLoaderTest.php +++ b/test/Mustache/Test/Loader/ArrayLoaderTest.php @@ -3,7 +3,7 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2016 Justin Hileman + * (c) 2010-2017 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/test/Mustache/Test/Loader/CascadingLoaderTest.php b/test/Mustache/Test/Loader/CascadingLoaderTest.php index 6d97d8d9..ecf80d6f 100644 --- a/test/Mustache/Test/Loader/CascadingLoaderTest.php +++ b/test/Mustache/Test/Loader/CascadingLoaderTest.php @@ -3,7 +3,7 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2016 Justin Hileman + * (c) 2010-2017 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/test/Mustache/Test/Loader/FilesystemLoaderTest.php b/test/Mustache/Test/Loader/FilesystemLoaderTest.php index 75880d40..8c06e76b 100644 --- a/test/Mustache/Test/Loader/FilesystemLoaderTest.php +++ b/test/Mustache/Test/Loader/FilesystemLoaderTest.php @@ -3,7 +3,7 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2016 Justin Hileman + * (c) 2010-2017 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/test/Mustache/Test/Loader/InlineLoaderTest.php b/test/Mustache/Test/Loader/InlineLoaderTest.php index 2f1d4140..24f2e0b3 100644 --- a/test/Mustache/Test/Loader/InlineLoaderTest.php +++ b/test/Mustache/Test/Loader/InlineLoaderTest.php @@ -3,7 +3,7 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2015 Justin Hileman + * (c) 2010-2017 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/test/Mustache/Test/Loader/ProductionFilesystemLoaderTest.php b/test/Mustache/Test/Loader/ProductionFilesystemLoaderTest.php new file mode 100644 index 00000000..0c7c7e30 --- /dev/null +++ b/test/Mustache/Test/Loader/ProductionFilesystemLoaderTest.php @@ -0,0 +1,103 @@ + '.ms')); + $this->assertInstanceOf('Mustache_Source', $loader->load('alpha')); + $this->assertEquals('alpha contents', $loader->load('alpha')->getSource()); + $this->assertInstanceOf('Mustache_Source', $loader->load('beta.ms')); + $this->assertEquals('beta contents', $loader->load('beta.ms')->getSource()); + } + + public function testTrailingSlashes() + { + $baseDir = dirname(__FILE__) . '/../../../fixtures/templates/'; + $loader = new Mustache_Loader_ProductionFilesystemLoader($baseDir); + $this->assertEquals('one contents', $loader->load('one')->getSource()); + } + + public function testConstructorWithProtocol() + { + $baseDir = realpath(dirname(__FILE__) . '/../../../fixtures/templates'); + + $loader = new Mustache_Loader_ProductionFilesystemLoader('file://' . $baseDir, array('extension' => '.ms')); + $this->assertEquals('alpha contents', $loader->load('alpha')->getSource()); + $this->assertEquals('beta contents', $loader->load('beta.ms')->getSource()); + } + + public function testLoadTemplates() + { + $baseDir = realpath(dirname(__FILE__) . '/../../../fixtures/templates'); + $loader = new Mustache_Loader_ProductionFilesystemLoader($baseDir); + $this->assertEquals('one contents', $loader->load('one')->getSource()); + $this->assertEquals('two contents', $loader->load('two.mustache')->getSource()); + } + + public function testEmptyExtensionString() + { + $baseDir = realpath(dirname(__FILE__) . '/../../../fixtures/templates'); + + $loader = new Mustache_Loader_ProductionFilesystemLoader($baseDir, array('extension' => '')); + $this->assertEquals('one contents', $loader->load('one.mustache')->getSource()); + $this->assertEquals('alpha contents', $loader->load('alpha.ms')->getSource()); + + $loader = new Mustache_Loader_ProductionFilesystemLoader($baseDir, array('extension' => null)); + $this->assertEquals('two contents', $loader->load('two.mustache')->getSource()); + $this->assertEquals('beta contents', $loader->load('beta.ms')->getSource()); + } + + /** + * @expectedException Mustache_Exception_RuntimeException + */ + public function testMissingBaseDirThrowsException() + { + new Mustache_Loader_ProductionFilesystemLoader(dirname(__FILE__) . '/not_a_directory'); + } + + /** + * @expectedException Mustache_Exception_UnknownTemplateException + */ + public function testMissingTemplateThrowsException() + { + $baseDir = realpath(dirname(__FILE__) . '/../../../fixtures/templates'); + $loader = new Mustache_Loader_ProductionFilesystemLoader($baseDir); + + $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/Loader/StringLoaderTest.php b/test/Mustache/Test/Loader/StringLoaderTest.php index f2e47d93..5896f00b 100644 --- a/test/Mustache/Test/Loader/StringLoaderTest.php +++ b/test/Mustache/Test/Loader/StringLoaderTest.php @@ -3,7 +3,7 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2016 Justin Hileman + * (c) 2010-2017 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/test/Mustache/Test/Logger/AbstractLoggerTest.php b/test/Mustache/Test/Logger/AbstractLoggerTest.php index e8865e94..19dc27cd 100644 --- a/test/Mustache/Test/Logger/AbstractLoggerTest.php +++ b/test/Mustache/Test/Logger/AbstractLoggerTest.php @@ -3,7 +3,7 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2016 Justin Hileman + * (c) 2010-2017 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/test/Mustache/Test/Logger/StreamLoggerTest.php b/test/Mustache/Test/Logger/StreamLoggerTest.php index 6cb198a8..fc1a06f1 100644 --- a/test/Mustache/Test/Logger/StreamLoggerTest.php +++ b/test/Mustache/Test/Logger/StreamLoggerTest.php @@ -3,7 +3,7 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2016 Justin Hileman + * (c) 2010-2017 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/test/Mustache/Test/ParserTest.php b/test/Mustache/Test/ParserTest.php index 85e5701a..d8458f76 100644 --- a/test/Mustache/Test/ParserTest.php +++ b/test/Mustache/Test/ParserTest.php @@ -3,7 +3,7 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2016 Justin Hileman + * (c) 2010-2017 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/test/Mustache/Test/Source/FilesystemSourceTest.php b/test/Mustache/Test/Source/FilesystemSourceTest.php new file mode 100644 index 00000000..a636ffe5 --- /dev/null +++ b/test/Mustache/Test/Source/FilesystemSourceTest.php @@ -0,0 +1,25 @@ +getKey(); + } +} diff --git a/test/Mustache/Test/SpecTestCase.php b/test/Mustache/Test/SpecTestCase.php index 9fb4a15e..db188dea 100644 --- a/test/Mustache/Test/SpecTestCase.php +++ b/test/Mustache/Test/SpecTestCase.php @@ -3,7 +3,7 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2016 Justin Hileman + * (c) 2010-2017 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/test/Mustache/Test/TemplateTest.php b/test/Mustache/Test/TemplateTest.php index bb260d2e..60065aad 100644 --- a/test/Mustache/Test/TemplateTest.php +++ b/test/Mustache/Test/TemplateTest.php @@ -3,7 +3,7 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2016 Justin Hileman + * (c) 2010-2017 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/test/Mustache/Test/TokenizerTest.php b/test/Mustache/Test/TokenizerTest.php index 09be3fe5..38f16dc4 100644 --- a/test/Mustache/Test/TokenizerTest.php +++ b/test/Mustache/Test/TokenizerTest.php @@ -3,7 +3,7 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2016 Justin Hileman + * (c) 2010-2017 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/test/bootstrap.php b/test/bootstrap.php index 21fc6896..b3d0a199 100644 --- a/test/bootstrap.php +++ b/test/bootstrap.php @@ -3,7 +3,7 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2016 Justin Hileman + * (c) 2010-2017 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/test/fixtures/autoloader/Mustache/Bar.php b/test/fixtures/autoloader/Mustache/Bar.php index 80927224..35c2668b 100644 --- a/test/fixtures/autoloader/Mustache/Bar.php +++ b/test/fixtures/autoloader/Mustache/Bar.php @@ -3,7 +3,7 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2016 Justin Hileman + * (c) 2010-2017 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/test/fixtures/autoloader/Mustache/Foo.php b/test/fixtures/autoloader/Mustache/Foo.php index 7e6ef3ab..45837eee 100644 --- a/test/fixtures/autoloader/Mustache/Foo.php +++ b/test/fixtures/autoloader/Mustache/Foo.php @@ -3,7 +3,7 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2016 Justin Hileman + * (c) 2010-2017 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/test/fixtures/autoloader/NonMustacheClass.php b/test/fixtures/autoloader/NonMustacheClass.php index d8d59294..be6153b7 100644 --- a/test/fixtures/autoloader/NonMustacheClass.php +++ b/test/fixtures/autoloader/NonMustacheClass.php @@ -3,7 +3,7 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2016 Justin Hileman + * (c) 2010-2017 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/test/fixtures/examples/anchored_dot_notation/AnchoredDotNotation.php b/test/fixtures/examples/anchored_dot_notation/AnchoredDotNotation.php new file mode 100644 index 00000000..c075f65c --- /dev/null +++ b/test/fixtures/examples/anchored_dot_notation/AnchoredDotNotation.php @@ -0,0 +1,55 @@ + 'Punk', + 'subgenres' => array( + array( + 'name' => 'Hardcore', + 'subgenres' => array( + array( + 'name' => 'First wave of black metal', + 'subgenres' => array( + array('name' => 'Norwegian black metal'), + array( + 'name' => 'Death metal', + 'subgenres' => array( + array( + 'name' => 'Swedish death metal', + 'subgenres' => array( + array('name' => 'New wave of American metal'), + ), + ), + ), + ), + ), + ), + array( + 'name' => 'Thrash metal', + 'subgenres' => array( + array('name' => 'Grindcore'), + array( + 'name' => 'Metalcore', + 'subgenres' => array( + array('name' => 'Nu metal'), + ), + ), + ), + ), + ), + ), + ), + ), + ); +} diff --git a/test/fixtures/examples/anchored_dot_notation/anchored_dot_notation.mustache b/test/fixtures/examples/anchored_dot_notation/anchored_dot_notation.mustache new file mode 100644 index 00000000..9494fb10 --- /dev/null +++ b/test/fixtures/examples/anchored_dot_notation/anchored_dot_notation.mustache @@ -0,0 +1,4 @@ +{{% ANCHORED-DOT }} +{{# genres }} +{{> genre }} +{{/ genres }} \ No newline at end of file diff --git a/test/fixtures/examples/anchored_dot_notation/anchored_dot_notation.txt b/test/fixtures/examples/anchored_dot_notation/anchored_dot_notation.txt new file mode 100644 index 00000000..fa56efc9 --- /dev/null +++ b/test/fixtures/examples/anchored_dot_notation/anchored_dot_notation.txt @@ -0,0 +1,11 @@ + - Punk + - Hardcore + - First wave of black metal + - Norwegian black metal + - Death metal + - Swedish death metal + - New wave of American metal + - Thrash metal + - Grindcore + - Metalcore + - Nu metal diff --git a/test/fixtures/examples/anchored_dot_notation/partials/genre.mustache b/test/fixtures/examples/anchored_dot_notation/partials/genre.mustache new file mode 100644 index 00000000..f51c503b --- /dev/null +++ b/test/fixtures/examples/anchored_dot_notation/partials/genre.mustache @@ -0,0 +1,5 @@ +{{% ANCHORED-DOT }} + - {{ name }} +{{# .subgenres }} + {{> genre }} +{{/ .subgenres }} \ No newline at end of file diff --git a/test/fixtures/examples/blocks/Blocks.php b/test/fixtures/examples/blocks/Blocks.php index 2a7cb206..6362aca2 100644 --- a/test/fixtures/examples/blocks/Blocks.php +++ b/test/fixtures/examples/blocks/Blocks.php @@ -3,7 +3,7 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2016 Justin Hileman + * (c) 2010-2017 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/test/fixtures/examples/child_context/ChildContext.php b/test/fixtures/examples/child_context/ChildContext.php index 9ef84ae5..d898e5b3 100644 --- a/test/fixtures/examples/child_context/ChildContext.php +++ b/test/fixtures/examples/child_context/ChildContext.php @@ -3,7 +3,7 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2016 Justin Hileman + * (c) 2010-2017 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/test/fixtures/examples/comments/Comments.php b/test/fixtures/examples/comments/Comments.php index 690d139e..88fe821a 100644 --- a/test/fixtures/examples/comments/Comments.php +++ b/test/fixtures/examples/comments/Comments.php @@ -3,7 +3,7 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2016 Justin Hileman + * (c) 2010-2017 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/test/fixtures/examples/complex/complex.php b/test/fixtures/examples/complex/complex.php index ebb27332..7c696153 100644 --- a/test/fixtures/examples/complex/complex.php +++ b/test/fixtures/examples/complex/complex.php @@ -3,7 +3,7 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2016 Justin Hileman + * (c) 2010-2017 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/test/fixtures/examples/delimiters/Delimiters.php b/test/fixtures/examples/delimiters/Delimiters.php index e3b044d2..235a0886 100644 --- a/test/fixtures/examples/delimiters/Delimiters.php +++ b/test/fixtures/examples/delimiters/Delimiters.php @@ -3,7 +3,7 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2016 Justin Hileman + * (c) 2010-2017 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/test/fixtures/examples/dot_notation/DotNotation.php b/test/fixtures/examples/dot_notation/DotNotation.php index d4003185..eadbf61d 100644 --- a/test/fixtures/examples/dot_notation/DotNotation.php +++ b/test/fixtures/examples/dot_notation/DotNotation.php @@ -3,7 +3,7 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2016 Justin Hileman + * (c) 2010-2017 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/test/fixtures/examples/double_section/DoubleSection.php b/test/fixtures/examples/double_section/DoubleSection.php index 6989d95a..1b3f6b66 100644 --- a/test/fixtures/examples/double_section/DoubleSection.php +++ b/test/fixtures/examples/double_section/DoubleSection.php @@ -3,7 +3,7 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2016 Justin Hileman + * (c) 2010-2017 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/test/fixtures/examples/escaped/Escaped.php b/test/fixtures/examples/escaped/Escaped.php index 2e5805be..f2510c60 100644 --- a/test/fixtures/examples/escaped/Escaped.php +++ b/test/fixtures/examples/escaped/Escaped.php @@ -3,7 +3,7 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2016 Justin Hileman + * (c) 2010-2017 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/test/fixtures/examples/filters/Filters.php b/test/fixtures/examples/filters/Filters.php index fb7c3f51..eb6e3b77 100644 --- a/test/fixtures/examples/filters/Filters.php +++ b/test/fixtures/examples/filters/Filters.php @@ -3,7 +3,7 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2016 Justin Hileman + * (c) 2010-2017 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/test/fixtures/examples/grand_parent_context/GrandParentContext.php b/test/fixtures/examples/grand_parent_context/GrandParentContext.php index e3ea25f3..2ee0e428 100644 --- a/test/fixtures/examples/grand_parent_context/GrandParentContext.php +++ b/test/fixtures/examples/grand_parent_context/GrandParentContext.php @@ -3,7 +3,7 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2016 Justin Hileman + * (c) 2010-2017 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/test/fixtures/examples/i18n/I18n.php b/test/fixtures/examples/i18n/I18n.php index 77dc7b25..c36bf709 100644 --- a/test/fixtures/examples/i18n/I18n.php +++ b/test/fixtures/examples/i18n/I18n.php @@ -3,7 +3,7 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2016 Justin Hileman + * (c) 2010-2017 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/test/fixtures/examples/implicit_iterator/ImplicitIterator.php b/test/fixtures/examples/implicit_iterator/ImplicitIterator.php index 6a264773..074f8f49 100644 --- a/test/fixtures/examples/implicit_iterator/ImplicitIterator.php +++ b/test/fixtures/examples/implicit_iterator/ImplicitIterator.php @@ -3,7 +3,7 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2016 Justin Hileman + * (c) 2010-2017 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/test/fixtures/examples/inverted_double_section/InvertedDoubleSection.php b/test/fixtures/examples/inverted_double_section/InvertedDoubleSection.php index 79466409..32bc6cf6 100644 --- a/test/fixtures/examples/inverted_double_section/InvertedDoubleSection.php +++ b/test/fixtures/examples/inverted_double_section/InvertedDoubleSection.php @@ -3,7 +3,7 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2016 Justin Hileman + * (c) 2010-2017 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/test/fixtures/examples/inverted_section/InvertedSection.php b/test/fixtures/examples/inverted_section/InvertedSection.php index a4ab8d5c..5defa9ed 100644 --- a/test/fixtures/examples/inverted_section/InvertedSection.php +++ b/test/fixtures/examples/inverted_section/InvertedSection.php @@ -3,7 +3,7 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2016 Justin Hileman + * (c) 2010-2017 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/test/fixtures/examples/nested_partials/NestedPartials.php b/test/fixtures/examples/nested_partials/NestedPartials.php index 1a5afd34..a2a2bb16 100644 --- a/test/fixtures/examples/nested_partials/NestedPartials.php +++ b/test/fixtures/examples/nested_partials/NestedPartials.php @@ -3,7 +3,7 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2016 Justin Hileman + * (c) 2010-2017 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/test/fixtures/examples/partials/Partials.php b/test/fixtures/examples/partials/Partials.php index 1bdaaa19..e91dc681 100644 --- a/test/fixtures/examples/partials/Partials.php +++ b/test/fixtures/examples/partials/Partials.php @@ -3,7 +3,7 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2016 Justin Hileman + * (c) 2010-2017 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/test/fixtures/examples/recursive_partials/RecursivePartials.php b/test/fixtures/examples/recursive_partials/RecursivePartials.php index 25d15fd6..15b6973d 100644 --- a/test/fixtures/examples/recursive_partials/RecursivePartials.php +++ b/test/fixtures/examples/recursive_partials/RecursivePartials.php @@ -3,7 +3,7 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2016 Justin Hileman + * (c) 2010-2017 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/test/fixtures/examples/section_iterator_objects/SectionIteratorObjects.php b/test/fixtures/examples/section_iterator_objects/SectionIteratorObjects.php index 77e083eb..0dc793c2 100644 --- a/test/fixtures/examples/section_iterator_objects/SectionIteratorObjects.php +++ b/test/fixtures/examples/section_iterator_objects/SectionIteratorObjects.php @@ -3,7 +3,7 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2016 Justin Hileman + * (c) 2010-2017 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/test/fixtures/examples/section_magic_objects/SectionMagicObjects.php b/test/fixtures/examples/section_magic_objects/SectionMagicObjects.php index 54288d65..0fcb3b4b 100644 --- a/test/fixtures/examples/section_magic_objects/SectionMagicObjects.php +++ b/test/fixtures/examples/section_magic_objects/SectionMagicObjects.php @@ -3,7 +3,7 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2016 Justin Hileman + * (c) 2010-2017 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/test/fixtures/examples/section_objects/SectionObjects.php b/test/fixtures/examples/section_objects/SectionObjects.php index b977ec58..913c3ebd 100644 --- a/test/fixtures/examples/section_objects/SectionObjects.php +++ b/test/fixtures/examples/section_objects/SectionObjects.php @@ -3,7 +3,7 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2016 Justin Hileman + * (c) 2010-2017 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/test/fixtures/examples/sections/Sections.php b/test/fixtures/examples/sections/Sections.php index 86bc893c..cf918c12 100644 --- a/test/fixtures/examples/sections/Sections.php +++ b/test/fixtures/examples/sections/Sections.php @@ -3,7 +3,7 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2016 Justin Hileman + * (c) 2010-2017 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/test/fixtures/examples/sections_nested/SectionsNested.php b/test/fixtures/examples/sections_nested/SectionsNested.php index dccc0d94..43657c3d 100644 --- a/test/fixtures/examples/sections_nested/SectionsNested.php +++ b/test/fixtures/examples/sections_nested/SectionsNested.php @@ -3,7 +3,7 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2016 Justin Hileman + * (c) 2010-2017 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/test/fixtures/examples/simple/Simple.php b/test/fixtures/examples/simple/Simple.php index 570af22b..a5492e8f 100644 --- a/test/fixtures/examples/simple/Simple.php +++ b/test/fixtures/examples/simple/Simple.php @@ -3,7 +3,7 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2016 Justin Hileman + * (c) 2010-2017 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/test/fixtures/examples/unescaped/Unescaped.php b/test/fixtures/examples/unescaped/Unescaped.php index abe91787..ea85f885 100644 --- a/test/fixtures/examples/unescaped/Unescaped.php +++ b/test/fixtures/examples/unescaped/Unescaped.php @@ -3,7 +3,7 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2016 Justin Hileman + * (c) 2010-2017 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/test/fixtures/examples/utf8/UTF8.php b/test/fixtures/examples/utf8/UTF8.php index 8c149411..c53fec9f 100644 --- a/test/fixtures/examples/utf8/UTF8.php +++ b/test/fixtures/examples/utf8/UTF8.php @@ -3,7 +3,7 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2016 Justin Hileman + * (c) 2010-2017 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/test/fixtures/examples/utf8_unescaped/UTF8Unescaped.php b/test/fixtures/examples/utf8_unescaped/UTF8Unescaped.php index 43096754..67f93666 100644 --- a/test/fixtures/examples/utf8_unescaped/UTF8Unescaped.php +++ b/test/fixtures/examples/utf8_unescaped/UTF8Unescaped.php @@ -3,7 +3,7 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2016 Justin Hileman + * (c) 2010-2017 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/test/fixtures/examples/whitespace/Whitespace.php b/test/fixtures/examples/whitespace/Whitespace.php index d5a5c620..57a3267f 100644 --- a/test/fixtures/examples/whitespace/Whitespace.php +++ b/test/fixtures/examples/whitespace/Whitespace.php @@ -3,7 +3,7 @@ /* * This file is part of Mustache.php. * - * (c) 2010-2016 Justin Hileman + * (c) 2010-2017 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code.