Пример #1
0
 public function testResolveDependency()
 {
     $tasks = array(array('project' => 'Project 1', 'name' => 'hello world 2', 'asignee' => 'someone 1', 'startDate' => strtotime('2015-10-05'), 'workload' => 10), array('project' => 'Project 2', 'name' => 'hello world 3', 'asignee' => 'someone 2', 'dependency' => 'afterPrevious', 'workload' => 10));
     $nonBusinessdays = array(strtotime('2015-10-02'), strtotime('2015-10-06'), strtotime('2015-11-23'), strtotime('2015-11-24'));
     $gantt = new PhpGantt($tasks, $nonBusinessdays);
     $actual = $gantt->resolveDependency($tasks);
     $expected = array(array('project' => 'Project 1', 'name' => 'hello world 2', 'asignee' => 'someone 1', 'startDate' => strtotime('2015-10-05'), 'workload' => 10, 'endDate' => strtotime('2015-10-19')), array('project' => 'Project 2', 'name' => 'hello world 3', 'asignee' => 'someone 2', 'dependency' => 'afterPrevious', 'workload' => 10, 'startDate' => strtotime('2015-10-20'), 'endDate' => strtotime('2015-11-02')));
     $this->assertSame($expected, $actual);
 }
Пример #2
0
 public function testBuildTableHeader()
 {
     $nonBusinessdays = array(strtotime('2016-07-04'));
     $dateUtil = new DateUtil($nonBusinessdays, array(0, 6));
     $htmlBuilder = new HtmlBuilder($dateUtil);
     $tasks = array(array('project' => 'Project 1', 'name' => 'hello world 2', 'asignee' => 'someone 1', 'startDate' => strtotime('2016-07-01'), 'workload' => 3), array('project' => 'Project 2', 'name' => 'hello world 3', 'asignee' => 'someone 2', 'dependency' => 'afterPrevious', 'workload' => 3));
     $phpgantt = new PhpGantt($tasks, $nonBusinessdays);
     $tasks = $phpgantt->resolveDependency($tasks);
     $html = $htmlBuilder->buildTableHeader($phpgantt->dates, $tasks);
     $actual = substr_count($html, 'project_name');
     $expected = 5;
     $this->assertSame($actual, $expected);
 }