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