/** * {@inheritdoc} */ protected function setUp() { parent::setUp(); $this->libraryDiscovery = $this->getMockBuilder('Drupal\\Core\\Asset\\LibraryDiscovery')->disableOriginalConstructor()->getMock(); $this->libraryDependencyResolver = $this->getMock('\\Drupal\\Core\\Asset\\LibraryDependencyResolverInterface'); $this->libraryDependencyResolver->expects($this->any())->method('getLibrariesWithDependencies')->willReturnArgument(0); $this->moduleHandler = $this->getMock('\\Drupal\\Core\\Extension\\ModuleHandlerInterface'); $this->themeManager = $this->getMock('\\Drupal\\Core\\Theme\\ThemeManagerInterface'); $active_theme = $this->getMockBuilder('\\Drupal\\Core\\Theme\\ActiveTheme')->disableOriginalConstructor()->getMock(); $active_theme->expects($this->any())->method('getName')->willReturn('bartik'); $this->themeManager->expects($this->any())->method('getActiveTheme')->willReturn($active_theme); $this->languageManager = $this->getMock('\\Drupal\\Core\\Language\\LanguageManagerInterface'); $english = $this->getMock('\\Drupal\\Core\\Language\\LanguageInterface'); $english->expects($this->any())->method('getId')->willReturn('en'); $japanese = $this->getMock('\\Drupal\\Core\\Language\\LanguageInterface'); $japanese->expects($this->any())->method('getId')->willReturn('jp'); $this->languageManager = $this->getMock('\\Drupal\\Core\\Language\\LanguageManagerInterface'); $this->languageManager->expects($this->any())->method('getCurrentLanguage')->will($this->onConsecutiveCalls($english, $english, $japanese, $japanese)); $this->cache = new TestMemoryBackend('llama'); $this->assetResolver = new AssetResolver($this->libraryDiscovery, $this->libraryDependencyResolver, $this->moduleHandler, $this->themeManager, $this->languageManager, $this->cache); }