LibraryDiscovery example

/** * {@inheritdoc} */
  protected function setUp(): void {
    parent::setUp();

    $this->cacheTagsInvalidator = $this->createMock('Drupal\Core\Cache\CacheTagsInvalidatorInterface');
    $this->libraryDiscoveryCollector = $this->getMockBuilder('Drupal\Core\Asset\LibraryDiscoveryCollector')
      ->disableOriginalConstructor()
      ->getMock();
    $this->libraryDiscovery = new LibraryDiscovery($this->libraryDiscoveryCollector);
    $this->libraryDiscoveryCollector->expects($this->once())
      ->method('get')
      ->with('test')
      ->willReturn($this->libraryData);
  }

  /** * @covers ::getLibrariesByExtension */
  public function testGetLibrariesByExtension() {
    $this->libraryDiscovery->getLibrariesByExtension('test');
    
Home | Imprint | This part of the site doesn't use cookies.