Permalink
Browse files

Test and fix for issue #66

  • Loading branch information...
1 parent a1e1a55 commit cc565013d0446028aed635b232f515b2d14e9580 @mackstar mackstar committed Jan 15, 2012
View
@@ -91,6 +91,9 @@ public static function __init() {
$self = get_called_class();
static::$_exceptionHandler = function($exception, $return = false) use ($self) {
+ if (ob_get_length()) {
+ ob_end_clean();
+ }
$info = compact('exception') + array(
'type' => get_class($exception),
'stack' => $self::trace($exception->getTrace())
@@ -305,6 +305,9 @@ public function helper($name, array $config = array()) {
$config += array('context' => $this);
return $this->_helpers[$name] = Libraries::instance('helper', ucfirst($name), $config);
} catch (ClassNotFoundException $e) {
+ if (ob_get_length()) {
+ ob_end_clean();
+ }
throw new RuntimeException("Helper `{$name}` not found.");
}
}
@@ -146,6 +146,15 @@ public function testErrorTrapping() {
// Undefined offset error shouldn't surface.
list($foo, $bar) = array('baz');
}
+
+ public function testRenderedOutput() {
+ ob_start();
+ echo 'Some Output';
+ $subject = new ErrorHandlerTest();
+ ErrorHandler::apply(array($subject, 'throwException'), array(), function($details) {});
+ $subject->throwException();
+ $this->assertFalse(ob_get_length());
+ }
}
?>
@@ -236,10 +236,10 @@ public function testStringParameterConnect() {
$ex = "No parameter match found for URL `(";
$ex .= "'controller' => 'posts', 'action' => 'view', 'id' => '4bbf25bd8ead0e5180130000')`.";
$this->expectException($ex);
-
$result = Router::match(array(
'controller' => 'posts', 'action' => 'view', 'id' => '4bbf25bd8ead0e5180130000'
));
+ $this->assertFalse(ob_get_length());
}
public function testShorthandParameterMatching() {

0 comments on commit cc56501

Please sign in to comment.