/**
  * @expectedException Expressly\Exception\InvalidURIException
  */
 public function testBuildingEntityWithPlaceholderAndInvalidData()
 {
     $entity = new ExternalRoute(new Response(), new Request(), new Curl());
     $entity->setMethod('GET')->setHost('https://dev.expresslyapp.com/api/v2')->setURI('/migration/<uuid>')->setRules(array('uuid' => new UuidValidator('uuid not valid')))->setParameters(array('uuid' => 'not_a_uuid'));
     // raises InvalidURIException
     $entity->getURL();
 }
 public function __construct(Container $container, $hosts, $routes)
 {
     $this->routes = new ArrayCollection();
     foreach ($routes as $key => $definition) {
         $route = new ExternalRoute(new Response(), new Request(), new Curl());
         $route->setHost($hosts[$definition['host']])->setURI($definition['uri'])->setMethod($definition['method']);
         if (!empty($definition['validation'])) {
             $validation = array();
             foreach ($definition['validation'] as $parameter => $validatorKey) {
                 $validation[$parameter] = $container["{$validatorKey}.validator"];
             }
             $route->setRules($validation);
         }
         $this->routes->set($key, $route);
     }
 }