本文整理匯總了PHP中Trace::execute方法的典型用法代碼示例。如果您正苦於以下問題:PHP Trace::execute方法的具體用法?PHP Trace::execute怎麽用?PHP Trace::execute使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Trace
的用法示例。
在下文中一共展示了Trace::execute方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: testExecute
public function testExecute()
{
$instance = new Trace('');
$session = $this->getMock('Pry\\Session', ['getCallStack'], [__FILE__]);
$callStack = $this->getMock('Pry\\CallStack', ['getTrace']);
$trace = [['class' => 'A', 'type' => '->', 'function' => 'a', 'args' => ['one', 'two'], 'file' => '/a.php', 'line' => 1337], ['function' => 'b', 'args' => ['one'], 'file' => '/b.php', 'line' => 321], ['class' => 'C', 'type' => '::', 'function' => 'c', 'args' => [], 'file' => '/c.php', 'line' => 42]];
$callStack->expects($this->once())->method('getTrace')->will($this->returnValue($trace));
$session->expects($this->once())->method('getCallStack')->will($this->returnValue($callStack));
ob_start();
$status = $instance->execute($session);
$actual = ob_get_contents();
ob_end_clean();
$expected = [' A->a($0,$1) /a.php 1337 ', ' b($0) /b.php 321 ', ' C::c() /c.php 42 ', ''];
$this->assertTrue($status);
$this->assertEquals(implode(PHP_EOL, $expected), $actual);
# @TODO check $actual for correct contents
}