function it_can_create(Factory\NodeFactory $nodeFactory, Factory\EnvironmentFactory $envFactory)
 {
     $nodesConfig = array('nodes-value');
     $environmentsConfig = array('environments-value');
     $nodes = array('nodes');
     $environments = array();
     $nodeFactory->create($nodesConfig)->willReturn($nodes);
     $envFactory->create($environmentsConfig, $nodes)->willReturn($environments);
     $this->create(array('nodes' => $nodesConfig, 'environments' => $environmentsConfig))->shouldReturnAnInstanceOf('Assimtech\\Tempo\\Infrastructure');
 }
 /**
  * @param array|null $config
  * @return \Assimtech\Tempo\Infrastructure
  * @throws \InvalidArgumentException
  */
 public function create(array $config)
 {
     if (!isset($config['nodes'])) {
         throw new InvalidArgumentException('config: [nodes] is mandatory');
     }
     if (!isset($config['environments'])) {
         throw new InvalidArgumentException('config: [environments] is mandatory');
     }
     $nodes = $this->nodeFactory->create($config['nodes']);
     $environments = $this->envFactory->create($config['environments'], $nodes);
     $infrastructure = new Infrastructure();
     $infrastructure->addEnvironments($environments);
     return $infrastructure;
 }