本文整理汇总了PHP中Cake\Error\Debugger::excerpt方法的典型用法代码示例。如果您正苦于以下问题:PHP Debugger::excerpt方法的具体用法?PHP Debugger::excerpt怎么用?PHP Debugger::excerpt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cake\Error\Debugger
的用法示例。
在下文中一共展示了Debugger::excerpt方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testExcerpt
/**
* test Excerpt writing
*
* @return void
*/
public function testExcerpt()
{
$result = Debugger::excerpt(__FILE__, __LINE__ - 1, 2);
$this->assertTrue(is_array($result));
$this->assertCount(5, $result);
$this->assertRegExp('/function(.+)testExcerpt/', $result[1]);
$result = Debugger::excerpt(__FILE__, 2, 2);
$this->assertTrue(is_array($result));
$this->assertCount(4, $result);
$this->skipIf(defined('HHVM_VERSION'), 'HHVM does not highlight php code');
$pattern = '/<code>.*?<span style\\="color\\: \\#\\d+">.*?<\\?php/';
$this->assertRegExp($pattern, $result[0]);
$result = Debugger::excerpt(__FILE__, 11, 2);
$this->assertCount(5, $result);
$pattern = '/<span style\\="color\\: \\#\\d{6}">\\*<\\/span>/';
$this->assertRegExp($pattern, $result[0]);
$return = Debugger::excerpt('[internal]', 2, 2);
$this->assertTrue(empty($return));
$result = Debugger::excerpt(__FILE__, __LINE__, 5);
$this->assertCount(11, $result);
$this->assertContains('Debugger', $result[5]);
$this->assertContains('excerpt', $result[5]);
$this->assertContains('__FILE__', $result[5]);
}
示例2: testExcerpt
/**
* test Excerpt writing
*
* @return void
*/
public function testExcerpt()
{
$result = Debugger::excerpt(__FILE__, __LINE__, 2);
$this->assertTrue(is_array($result));
$this->assertEquals(5, count($result));
$this->assertRegExp('/function(.+)testExcerpt/', $result[1]);
$result = Debugger::excerpt(__FILE__, 2, 2);
$this->assertTrue(is_array($result));
$this->assertEquals(4, count($result));
$pattern = '/<code>.*?<span style\\="color\\: \\#\\d+">.*?<\\?php/';
$this->assertRegExp($pattern, $result[0]);
$result = Debugger::excerpt(__FILE__, 11, 2);
$this->assertEquals(5, count($result));
$pattern = '/<span style\\="color\\: \\#\\d{6}">\\*<\\/span>/';
$this->assertRegExp($pattern, $result[0]);
$return = Debugger::excerpt('[internal]', 2, 2);
$this->assertTrue(empty($return));
}