You are here

public function LibraryDiscoveryParserTest::testInvalidLibrariesFile in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/tests/Drupal/Tests/Core/Asset/LibraryDiscoveryParserTest.php \Drupal\Tests\Core\Asset\LibraryDiscoveryParserTest::testInvalidLibrariesFile()

Tests that an exception is thrown when a libraries file couldn't be parsed.

@expectedException \Drupal\Core\Asset\Exception\InvalidLibraryFileException

@covers ::buildByExtension

File

core/tests/Drupal/Tests/Core/Asset/LibraryDiscoveryParserTest.php, line 150
Contains \Drupal\Tests\Core\Asset\LibraryDiscoveryParserTest.

Class

LibraryDiscoveryParserTest
@coversDefaultClass \Drupal\Core\Asset\LibraryDiscoveryParser @group Asset

Namespace

Drupal\Tests\Core\Asset

Code

public function testInvalidLibrariesFile() {
  $this->moduleHandler
    ->expects($this
    ->atLeastOnce())
    ->method('moduleExists')
    ->with('invalid_file')
    ->will($this
    ->returnValue(TRUE));
  $path = __DIR__ . '/library_test_files';
  $path = substr($path, strlen($this->root) + 1);
  $this->libraryDiscoveryParser
    ->setPaths('module', 'invalid_file', $path);
  $this->libraryDiscoveryParser
    ->buildByExtension('invalid_file');
}