You are here

public function LibraryPolicyBuilderTest::testEmptyPolicy in Content-Security-Policy 8

Test an empty extension set.

@covers ::getSources @covers ::getExtensionSources @covers ::getLibrarySources

File

tests/src/Unit/LibraryPolicyBuilderTest.php, line 81

Class

LibraryPolicyBuilderTest
@coversDefaultClass \Drupal\csp\LibraryPolicyBuilder @group csp

Namespace

Drupal\Tests\csp\Unit

Code

public function testEmptyPolicy() {
  $this->themeHandler
    ->expects($this
    ->atLeastOnce())
    ->method('listInfo')
    ->willReturn([]);
  $this->moduleHandler
    ->expects($this
    ->atLeastOnce())
    ->method('getModuleList')
    ->willReturn([]);
  $this->libraryDiscovery
    ->expects($this
    ->atLeastOnce())
    ->method('getLibrariesByExtension')
    ->with('core')
    ->willReturn([]);
  $libraryPolicy = new LibraryPolicyBuilder($this->cache, $this->moduleHandler, $this->themeHandler, $this->libraryDiscovery);
  $this
    ->assertEquals([], $libraryPolicy
    ->getSources());
}