public function testConcat() { $this->coll->add(1)->add(2)->add(4); $coll2 = new ArrayList([3]); $this->coll->concat($coll2); $this->assertEquals([1, 2, 4, 3], $this->coll->toArray()); $coll3 = new Dictionary(['key1' => 'value1', 'key2' => 'wrongValue']); $coll4 = new Dictionary(['key2' => 'value2']); $coll3->concat($coll4); $this->assertEquals(['key1' => 'value1', 'key2' => 'value2'], $coll3->toArray()); }
public function overdue() { $lists = $this->listService->all(); $overdueTasks = new ArrayList(); $today = Carbon::today(); foreach ($lists as $list) { $tasks = new ArrayList($this->forList($list)); $listTasks = $tasks->filter(function (Task $task) use($today) { if ($task->getDueDate()) { $date = Carbon::instance($task->getDueDate()); return $date->gt($today); } }); $overdueTasks->concat($listTasks); } return $overdueTasks; }