BUG Fix issue with CLIDebugView failing on class name of existing class

Fixes #7827
This commit is contained in:
Damian Mooyman 2018-02-09 09:52:32 +13:00
parent 09f88c76cf
commit 0a486b8f57
No known key found for this signature in database
GPG Key ID: 78B823A10DE27D1A
2 changed files with 12 additions and 1 deletions

View File

@ -160,7 +160,7 @@ class CliDebugView extends DebugView
public function debugVariableText($val)
{
// Check debug
if (ClassInfo::hasMethod($val, 'debug')) {
if (is_object($val) && ClassInfo::hasMethod($val, 'debug')) {
return $val->debug();
}

View File

@ -61,5 +61,16 @@ EOS
,
$view->debugVariable(new ObjectWithDebug(), $this->caller)
);
$this->assertEquals(
<<<EOS
Debug (CLIDebugViewTest.php:17 - SilverStripe\\Dev\\Tests\\CLIDebugViewTest::setUp())
SilverStripe\\Dev\\Tests\\DebugViewTest\\ObjectWithDebug
EOS
,
$view->debugVariable(ObjectWithDebug::class, $this->caller)
);
}
}