protected function AssetResolverTest::setUp in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/tests/Drupal/Tests/Core/Asset/AssetResolverTest.php \Drupal\Tests\Core\Asset\AssetResolverTest::setUp()
Overrides UnitTestCase::setUp
File
- core/
tests/ Drupal/ Tests/ Core/ Asset/ AssetResolverTest.php, line 74 - Contains \Drupal\Tests\Core\Asset\AssetResolverTest.
Class
- AssetResolverTest
- @coversDefaultClass \Drupal\Core\Asset\AssetResolver @group Asset
Namespace
Drupal\Tests\Core\AssetCode
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);
}