public function test__execute_called_on_each_child()
 {
     $context = $this->getContextMock();
     $action1 = $this->getActionMock();
     $action1->expects($this->once())->method('execute')->with($context);
     $composite = new CompositeAction([$action1]);
     $action2 = $this->getActionMock();
     $action2->expects($this->once())->method('execute')->with($context);
     $composite->add($action2);
     $composite->execute($context);
 }
 /**
  * @return CompositeAction
  */
 public function build()
 {
     $actions = $this->actions;
     ksort($actions);
     $result = new CompositeAction();
     foreach ($actions as $arr) {
         foreach ($arr as $action) {
             $result->add($action);
         }
     }
     return $result;
 }