/** * Get a log for an object * * @param \GitElephant\Objects\Object $obj The Object instance * @param null|string|\GitElephant\Objects\Branch $branch The branch to read from * @param int $limit Limit to n entries * @param int|null $offset Skip n entries * * @throws \RuntimeException * @throws \Symfony\Component\Process\Exception\LogicException * @throws \Symfony\Component\Process\Exception\InvalidArgumentException * @throws \Symfony\Component\Process\Exception\RuntimeException * @return \GitElephant\Objects\Log */ public function getObjectLog(Object $obj, $branch = null, $limit = 1, $offset = null) { $command = LogCommand::getInstance($this)->showObjectLog($obj, $branch, $limit, $offset); return Log::createFromOutputLines($this, $this->caller->execute($command)->getOutputLines()); }
/** * testLogCreatedFromOutputLines */ public function testLogCreatedFromOutputLines() { $tree = $this->getRepository()->getTree(); $obj = $tree[count($tree) - 1]; $logCommand = new LogCommand(); $command = $logCommand->showObjectLog($obj); $log = Log::createFromOutputLines($this->getRepository(), $this->caller->execute($command)->getOutputLines()); $this->assertInstanceOf('GitElephant\\Objects\\Log', $log); $this->assertCount(1, $log); }