mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
BUG Fix issue with DebugView failing on class name of existing class
Fixes #7827
This commit is contained in:
parent
b81ac41b5d
commit
288aaf083c
@ -421,7 +421,7 @@ class DebugView
|
|||||||
public function debugVariableText($val)
|
public function debugVariableText($val)
|
||||||
{
|
{
|
||||||
// Check debug
|
// Check debug
|
||||||
if (ClassInfo::hasMethod($val, 'debug')) {
|
if (is_object($val) && ClassInfo::hasMethod($val, 'debug')) {
|
||||||
return $val->debug();
|
return $val->debug();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ class DebugViewTest extends SapphireTest
|
|||||||
<<<EOS
|
<<<EOS
|
||||||
<div style="background-color: white; text-align: left;">
|
<div style="background-color: white; text-align: left;">
|
||||||
<hr>
|
<hr>
|
||||||
<h3>Debug <span style="font-size: 65%">(DebugViewTest.php:17 - SilverStripe\Dev\Tests\DebugViewTest::setUp())</span>
|
<h3>Debug <span style="font-size: 65%">(DebugViewTest.php:17 - SilverStripe\\Dev\\Tests\\DebugViewTest::setUp())</span>
|
||||||
</h3>
|
</h3>
|
||||||
<pre style="font-family: Courier new, serif">string</pre>
|
<pre style="font-family: Courier new, serif">string</pre>
|
||||||
</div>
|
</div>
|
||||||
@ -44,7 +44,7 @@ EOS
|
|||||||
<<<EOS
|
<<<EOS
|
||||||
<div style="background-color: white; text-align: left;">
|
<div style="background-color: white; text-align: left;">
|
||||||
<hr>
|
<hr>
|
||||||
<h3>Debug <span style="font-size: 65%">(DebugViewTest.php:17 - SilverStripe\Dev\Tests\DebugViewTest::setUp())</span>
|
<h3>Debug <span style="font-size: 65%">(DebugViewTest.php:17 - SilverStripe\\Dev\\Tests\\DebugViewTest::setUp())</span>
|
||||||
</h3>
|
</h3>
|
||||||
<ul>
|
<ul>
|
||||||
<li>key = <pre style="font-family: Courier new, serif">value</pre>
|
<li>key = <pre style="font-family: Courier new, serif">value</pre>
|
||||||
@ -62,12 +62,26 @@ EOS
|
|||||||
<<<EOS
|
<<<EOS
|
||||||
<div style="background-color: white; text-align: left;">
|
<div style="background-color: white; text-align: left;">
|
||||||
<hr>
|
<hr>
|
||||||
<h3>Debug <span style="font-size: 65%">(DebugViewTest.php:17 - SilverStripe\Dev\Tests\DebugViewTest::setUp())</span>
|
<h3>Debug <span style="font-size: 65%">(DebugViewTest.php:17 - SilverStripe\\Dev\\Tests\\DebugViewTest::setUp())</span>
|
||||||
</h3>
|
</h3>
|
||||||
SilverStripe\Dev\Tests\DebugViewTest\ObjectWithDebug::debug() custom content</div>
|
SilverStripe\\Dev\\Tests\\DebugViewTest\\ObjectWithDebug::debug() custom content</div>
|
||||||
EOS
|
EOS
|
||||||
,
|
,
|
||||||
$view->debugVariable(new ObjectWithDebug(), $this->caller)
|
$view->debugVariable(new ObjectWithDebug(), $this->caller)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$this->assertEquals(
|
||||||
|
<<<EOS
|
||||||
|
<div style="background-color: white; text-align: left;">
|
||||||
|
<hr>
|
||||||
|
<h3>Debug <span style="font-size: 65%">(DebugViewTest.php:17 - SilverStripe\\Dev\\Tests\\DebugViewTest::setUp())</span>
|
||||||
|
</h3>
|
||||||
|
<pre style="font-family: Courier new, serif">SilverStripe\\Dev\\Tests\\DebugViewTest\\ObjectWithDebug</pre>
|
||||||
|
</div>
|
||||||
|
EOS
|
||||||
|
|
||||||
|
,
|
||||||
|
$view->debugVariable(ObjectWithDebug::class, $this->caller)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user