Example #1
0
 public function testLoad()
 {
     $importedRouteCollection = new RouteCollection();
     $importedRouteCollection->add('route1', new Route('/example/route1'));
     $importedRouteCollection->add('route2', new Route('/route2'));
     $portal1 = new Portal();
     $portal1->setKey('sulu_lo');
     $portal2 = new Portal();
     $portal2->setKey('sulu_com');
     $portalInformations = [new PortalInformation(null, null, $portal1, null, 'sulu.io/de'), new PortalInformation(null, null, $portal2, null, 'sulu.com')];
     $this->loaderResolver->resolve(Argument::any(), Argument::any())->willReturn($this->loader->reveal());
     $this->loader->load(Argument::any(), Argument::any())->willReturn($importedRouteCollection);
     $this->webspaceManager->getPortalInformations(Argument::any())->willReturn($portalInformations);
     $routeCollection = $this->portalLoader->load('', 'portal');
     $this->assertCount(4, $routeCollection);
     $routes = $routeCollection->getIterator();
     $this->assertArrayHasKey('sulu.io/de.route1', $routes);
     $this->assertArrayHasKey('sulu.io/de.route2', $routes);
     $this->assertArrayHasKey('sulu.com.route1', $routes);
     $this->assertArrayHasKey('sulu.com.route2', $routes);
     $this->assertEquals('/de/example/route1', $routeCollection->get('sulu.io/de.route1')->getPath());
     $this->assertEquals('/de/route2', $routeCollection->get('sulu.io/de.route2')->getPath());
     $this->assertEquals('/example/route1', $routeCollection->get('sulu.com.route1')->getPath());
     $this->assertEquals('/route2', $routeCollection->get('sulu.com.route2')->getPath());
 }