/** * Tests the getWorkspaceSwitchLinks() method. */ public function testGetWorkspaceSwitchLinks() { $path = '<front>'; $request = Request::create($path); $query = array(); $url = Url::fromRoute('<front>'); $expected_links = array(1 => array('href' => $url, 'title' => null, 'query' => $query)); $this->requestStack->expects($this->once())->method('getCurrentRequest')->will($this->returnValue($request)); $workspace_manager = new WorkspaceManager($this->requestStack, $this->entityManager, $this->cacheRender); $workspace_manager->addNegotiator($this->workspaceNegotiators[1][0], 1); $this->workspaceNegotiators[1][0]->expects($this->any())->method('applies')->with($request)->will($this->returnValue(TRUE)); $this->workspaceNegotiators[1][0]->expects($this->once())->method('getWorkspaceSwitchLinks')->with($request, $url)->will($this->returnValue($expected_links)); $result_links = $workspace_manager->getWorkspaceSwitchLinks($url); $this->assertSame($expected_links, $result_links); }