Example #1
0
 public function push(Task $task)
 {
     if ($this->has($name = $task->getName())) {
         throw new \InvalidArgumentException(sprintf('A task with name "%s" is already defined.', $name));
     }
     $this->tasks[$name] = $task;
 }
Example #2
0
 function it_fails_when_adding_a_duplicate_task(Task $task6)
 {
     $task6->getName()->willReturn('minify');
     $this->shouldThrow('InvalidArgumentException')->duringPush($task6);
 }