public function MenuActiveTrailTest::testGetCid in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/tests/Drupal/Tests/Core/Menu/MenuActiveTrailTest.php \Drupal\Tests\Core\Menu\MenuActiveTrailTest::testGetCid()
Tests getCid()
@covers ::getCid
File
- core/
tests/ Drupal/ Tests/ Core/ Menu/ MenuActiveTrailTest.php, line 200 - Contains \Drupal\Tests\Core\Menu\MenuActiveTrailTest.
Class
- MenuActiveTrailTest
- Tests the active menu trail service.
Namespace
Drupal\Tests\Core\MenuCode
public function testGetCid() {
$data = $this
->provider()[1];
/** @var \Symfony\Component\HttpFoundation\Request $request */
$request = $data[0];
/** @var \Symfony\Component\Routing\Route $route */
$route = $request->attributes
->get(RouteObjectInterface::ROUTE_OBJECT);
$route
->setPath('/test/{b}/{a}');
$request->attributes
->get('_raw_variables')
->add([
'b' => 1,
'a' => 0,
]);
$this->requestStack
->push($request);
$this->menuLinkManager
->expects($this
->any())
->method('loadLinksbyRoute')
->with('baby_llama')
->will($this
->returnValue($data[1]));
$expected_link = $data[3];
$expected_trail = $data[4];
$expected_trail_ids = array_combine($expected_trail, $expected_trail);
$this->menuLinkManager
->expects($this
->any())
->method('getParentIds')
->will($this
->returnValueMap(array(
array(
$expected_link
->getPluginId(),
$expected_trail_ids,
),
)));
$this
->assertSame($expected_trail_ids, $this->menuActiveTrail
->getActiveTrailIds($data[2]));
$this->cache
->expects($this
->once())
->method('set')
->with('active-trail:route:baby_llama:route_parameters:' . serialize([
'a' => 0,
'b' => 1,
]));
$this->lock
->expects($this
->any())
->method('acquire')
->willReturn(TRUE);
$this->menuActiveTrail
->destruct();
}