Clean up pragma exception fix, add test coverage.

This commit is contained in:
Justin Hileman
2012-01-15 18:29:57 -08:00
parent 98e37ef4bf
commit 36ac3710f1
2 changed files with 29 additions and 5 deletions
+5 -5
View File
@@ -403,10 +403,11 @@ class Mustache {
$options_string = $matches['options_string'];
if (!in_array($pragma_name, $this->_pragmasImplemented)) {
if($this->_throwsException(MustacheException::UNKNOWN_PRAGMA))
if ($this->_throwsException(MustacheException::UNKNOWN_PRAGMA)) {
throw new MustacheException('Unknown pragma: ' . $pragma_name, MustacheException::UNKNOWN_PRAGMA);
else
} else {
return '';
}
}
$options = array();
@@ -451,10 +452,9 @@ class Mustache {
*/
protected function _getPragmaOptions($pragma_name) {
if (!$this->_hasPragma($pragma_name)) {
if($this->_throwsException(MustacheException::UNKNOWN_PRAGMA))
if ($this->_throwsException(MustacheException::UNKNOWN_PRAGMA)) {
throw new MustacheException('Unknown pragma: ' . $pragma_name, MustacheException::UNKNOWN_PRAGMA);
else
return array();
}
}
return (is_array($this->_localPragmas[$pragma_name])) ? $this->_localPragmas[$pragma_name] : array();