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 }