public function testTaskWorklogTotalTimeSpent() { $task = new Task(); $this->calculator->expects($this->once())->method('calculatePerTask')->with($task)->will($this->returnValue(new TimeSpent(10))); $total = $this->twigExtension->taskWorklogTotalTimeSpent($task); $this->assertEquals('10s', $total); }
public function testCalculatePerTask() { $task = new Task(); $worklogs = [new Worklog(new TimeSpent(5), new \DateTime('now'), $task, new User()), new Worklog(new TimeSpent(3), new \DateTime('now'), $task, new User())]; $this->worklogRepository->expects($this->once())->method('listAllFilteredByTask')->with($this->equalTo($task))->will($this->returnValue($worklogs)); $total = $this->calculator->calculatePerTask($task); $this->assertEquals(8, $total->getValue()); $this->assertEquals('8s', (string) $total); }
/** * @param Task $task * @return string */ public function taskWorklogTotalTimeSpent(Task $task) { $timeSpent = $this->calculator->calculatePerTask($task); return (string) $timeSpent; }