Merge pull request #7849 from open-sausages/pulls/4.0/fix-debug-string-class-cli

BUG Fix issue with CLIDebugView failing on class name of existing class
This commit is contained in:
Chris Joe 2018-02-09 15:41:18 +13:00 committed by GitHub
commit 95308e1af6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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)
);
}
}