Mark a few things we can't really get code coverage for.

This commit is contained in:
Justin Hileman
2017-07-03 00:16:08 -07:00
parent 14ff48584a
commit 6a527de467
6 changed files with 15 additions and 4 deletions
+6
View File
@@ -108,9 +108,11 @@ class Mustache_Cache_FilesystemCache extends Mustache_Cache_AbstractCache
); );
@mkdir($dirName, 0777, true); @mkdir($dirName, 0777, true);
// @codeCoverageIgnoreStart
if (!is_dir($dirName)) { if (!is_dir($dirName)) {
throw new Mustache_Exception_RuntimeException(sprintf('Failed to create cache directory "%s".', $dirName)); throw new Mustache_Exception_RuntimeException(sprintf('Failed to create cache directory "%s".', $dirName));
} }
// @codeCoverageIgnoreEnd
} }
return $dirName; return $dirName;
@@ -143,13 +145,17 @@ class Mustache_Cache_FilesystemCache extends Mustache_Cache_AbstractCache
return; return;
} }
// @codeCoverageIgnoreStart
$this->log( $this->log(
Mustache_Logger::ERROR, Mustache_Logger::ERROR,
'Unable to rename Mustache temp cache file: "{tempName}" -> "{fileName}"', 'Unable to rename Mustache temp cache file: "{tempName}" -> "{fileName}"',
array('tempName' => $tempFile, 'fileName' => $fileName) array('tempName' => $tempFile, 'fileName' => $fileName)
); );
// @codeCoverageIgnoreEnd
} }
// @codeCoverageIgnoreStart
throw new Mustache_Exception_RuntimeException(sprintf('Failed to write cache file "%s".', $fileName)); throw new Mustache_Exception_RuntimeException(sprintf('Failed to write cache file "%s".', $fileName));
// @codeCoverageIgnoreEnd
} }
} }
+1 -1
View File
@@ -27,7 +27,7 @@ class Mustache_Exception_SyntaxException extends LogicException implements Musta
if (version_compare(PHP_VERSION, '5.3.0', '>=')) { if (version_compare(PHP_VERSION, '5.3.0', '>=')) {
parent::__construct($msg, 0, $previous); parent::__construct($msg, 0, $previous);
} else { } else {
parent::__construct($msg); parent::__construct($msg); // @codeCoverageIgnore
} }
} }
@@ -27,7 +27,7 @@ class Mustache_Exception_UnknownFilterException extends UnexpectedValueException
if (version_compare(PHP_VERSION, '5.3.0', '>=')) { if (version_compare(PHP_VERSION, '5.3.0', '>=')) {
parent::__construct($message, 0, $previous); parent::__construct($message, 0, $previous);
} else { } else {
parent::__construct($message); parent::__construct($message); // @codeCoverageIgnore
} }
} }
@@ -27,7 +27,7 @@ class Mustache_Exception_UnknownHelperException extends InvalidArgumentException
if (version_compare(PHP_VERSION, '5.3.0', '>=')) { if (version_compare(PHP_VERSION, '5.3.0', '>=')) {
parent::__construct($message, 0, $previous); parent::__construct($message, 0, $previous);
} else { } else {
parent::__construct($message); parent::__construct($message); // @codeCoverageIgnore
} }
} }
@@ -27,7 +27,7 @@ class Mustache_Exception_UnknownTemplateException extends InvalidArgumentExcepti
if (version_compare(PHP_VERSION, '5.3.0', '>=')) { if (version_compare(PHP_VERSION, '5.3.0', '>=')) {
parent::__construct($message, 0, $previous); parent::__construct($message, 0, $previous);
} else { } else {
parent::__construct($message); parent::__construct($message); // @codeCoverageIgnore
} }
} }
+5
View File
@@ -91,11 +91,14 @@ class Mustache_Tokenizer
{ {
// Setting mbstring.func_overload makes things *really* slow. // Setting mbstring.func_overload makes things *really* slow.
// Let's do everyone a favor and scan this string as ASCII instead. // Let's do everyone a favor and scan this string as ASCII instead.
//
// @codeCoverageIgnoreStart
$encoding = null; $encoding = null;
if (function_exists('mb_internal_encoding') && ini_get('mbstring.func_overload') & 2) { if (function_exists('mb_internal_encoding') && ini_get('mbstring.func_overload') & 2) {
$encoding = mb_internal_encoding(); $encoding = mb_internal_encoding();
mb_internal_encoding('ASCII'); mb_internal_encoding('ASCII');
} }
// @codeCoverageIgnoreEnd
$this->reset(); $this->reset();
@@ -202,9 +205,11 @@ class Mustache_Tokenizer
$this->flushBuffer(); $this->flushBuffer();
// Restore the user's encoding... // Restore the user's encoding...
// @codeCoverageIgnoreStart
if ($encoding) { if ($encoding) {
mb_internal_encoding($encoding); mb_internal_encoding($encoding);
} }
// @codeCoverageIgnoreEnd
return $this->tokens; return $this->tokens;
} }