public function LibraryDiscoveryParserTest::testVersion in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/tests/Drupal/Tests/Core/Asset/LibraryDiscoveryParserTest.php \Drupal\Tests\Core\Asset\LibraryDiscoveryParserTest::testVersion()
Tests the version property, and how it propagates to the contained assets.
@covers ::buildByExtension
File
- core/
tests/ Drupal/ Tests/ Core/ Asset/ LibraryDiscoveryParserTest.php, line 189 - Contains \Drupal\Tests\Core\Asset\LibraryDiscoveryParserTest.
Class
- LibraryDiscoveryParserTest
- @coversDefaultClass \Drupal\Core\Asset\LibraryDiscoveryParser @group Asset
Namespace
Drupal\Tests\Core\AssetCode
public function testVersion() {
$this->moduleHandler
->expects($this
->atLeastOnce())
->method('moduleExists')
->with('versions')
->will($this
->returnValue(TRUE));
$path = __DIR__ . '/library_test_files';
$path = substr($path, strlen($this->root) + 1);
$this->libraryDiscoveryParser
->setPaths('module', 'versions', $path);
$libraries = $this->libraryDiscoveryParser
->buildByExtension('versions');
$this
->assertFalse(array_key_exists('version', $libraries['versionless']));
$this
->assertEquals(-1, $libraries['versionless']['css'][0]['version']);
$this
->assertEquals(-1, $libraries['versionless']['js'][0]['version']);
$this
->assertEquals('9.8.7.6', $libraries['versioned']['version']);
$this
->assertEquals('9.8.7.6', $libraries['versioned']['css'][0]['version']);
$this
->assertEquals('9.8.7.6', $libraries['versioned']['js'][0]['version']);
$this
->assertEquals(\Drupal::VERSION, $libraries['core-versioned']['version']);
$this
->assertEquals(\Drupal::VERSION, $libraries['core-versioned']['css'][0]['version']);
$this
->assertEquals(\Drupal::VERSION, $libraries['core-versioned']['js'][0]['version']);
}