diff --git a/core/modules/system/lib/Drupal/system/Tests/Error/FormatBacktraceUnitTest.php b/core/modules/system/lib/Drupal/system/Tests/Error/FormatBacktraceUnitTest.php new file mode 100644 index 0000000..822d06d --- /dev/null +++ b/core/modules/system/lib/Drupal/system/Tests/Error/FormatBacktraceUnitTest.php @@ -0,0 +1,68 @@ + 'Format Backtrace validation', + 'description' => 'Tests backtrace formatting by format_backtrace()', + 'group' => 'Error', + ); + } + + /** + * Tests format_backtrace() with test arrays. + */ + function testFormatBacktrace() { + // Test array. + $backtrace = array( + array( + 'class' => 'class', + 'type' => 'type', + 'function' => 'function', + 'args' => array(1, 1., NULL, new \stdClass, 'foo'), + ), + array( + 'class' => 'class', + 'type' => 'type', + 'function' => 'function', + ), + array( + 'function' => 'function', + 'args' => array(1, 1., NULL, new \stdClass, 'foo'), + ), + + array( + 'function' => 'function', + ), + array( + 'args' => array(1, 1., NULL, new \stdClass, 'foo'), + ), + array( + ), + ); + //debug(format_backtrace($backtrace)); + $result = 'classtypefunction(1, 1, NULL, Object, \'foo\') +classtypefunction() +function(1, 1, NULL, Object, \'foo\') +function() +main(1, 1, NULL, Object, \'foo\') +main() +'; + // Try +// $this->assertTrue(format_backtrace($backtrace)); + $this->assertEqual(format_backtrace($backtrace), $result); + + } +}