/** * {@inheritdoc} */ protected function setUp() { parent::setUp(); $this->accessManager = $this->getMock('\\Drupal\\Core\\Access\\AccessManagerInterface'); $this->currentUser = $this->getMock('Drupal\\Core\\Session\\AccountInterface'); $this->currentUser->method('isAuthenticated')->willReturn(TRUE); $this->queryFactory = $this->getMockBuilder('Drupal\\Core\\Entity\\Query\\QueryFactory')->disableOriginalConstructor()->getMock(); $this->defaultMenuTreeManipulators = new DefaultMenuLinkTreeManipulators($this->accessManager, $this->currentUser, $this->queryFactory); $cache_contexts_manager = $this->prophesize(CacheContextsManager::class); $cache_contexts_manager->assertValidTokens()->willReturn(TRUE); $cache_contexts_manager->reveal(); $container = new Container(); $container->set('cache_contexts_manager', $cache_contexts_manager); \Drupal::setContainer($container); }