function LibraryDiscoveryTest::setUp

Same name and namespace in other branches
  1. 11.x core/tests/Drupal/Tests/Core/Asset/LibraryDiscoveryTest.php \Drupal\Tests\Core\Asset\LibraryDiscoveryTest::setUp()
  2. 10 core/tests/Drupal/Tests/Core/Asset/LibraryDiscoveryTest.php \Drupal\Tests\Core\Asset\LibraryDiscoveryTest::setUp()
  3. 9 core/tests/Drupal/Tests/Core/Asset/LibraryDiscoveryTest.php \Drupal\Tests\Core\Asset\LibraryDiscoveryTest::setUp()
  4. 8.9.x core/tests/Drupal/Tests/Core/Asset/LibraryDiscoveryTest.php \Drupal\Tests\Core\Asset\LibraryDiscoveryTest::setUp()

Overrides UnitTestCase::setUp

File

core/tests/Drupal/Tests/Core/Asset/LibraryDiscoveryTest.php, line 63

Class

LibraryDiscoveryTest
Tests Drupal\Core\Asset\LibraryDiscovery.

Namespace

Drupal\Tests\Core\Asset

Code

protected function setUp() : void {
  parent::setUp();
  $this->cacheTagsInvalidator = $this->createMock('Drupal\\Core\\Cache\\CacheTagsInvalidatorInterface');
  $this->libraryDiscovery = $this->getMockBuilder('Drupal\\Core\\Asset\\LibraryDiscoveryCollector')
    ->onlyMethods([
    'resolveCacheMiss',
    'getLibrariesByExtension',
  ])
    ->disableOriginalConstructor()
    ->getMock();
  $this->libraryDiscovery
    ->expects($this->any())
    ->method('resolveCacheMiss')
    ->with('test')
    ->willReturn($this->libraryData);
  $this->libraryDiscovery
    ->expects($this->any())
    ->method('getLibrariesByExtension')
    ->with('test')
    ->willReturn($this->libraryData);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.