コード例 #1
0
 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);
 }
コード例 #2
0
 /**
  * @param Task $task
  * @return string
  */
 public function taskWorklogTotalTimeSpent(Task $task)
 {
     $timeSpent = $this->calculator->calculatePerTask($task);
     return (string) $timeSpent;
 }