.../system/src/Tests/Common/AttachedAssetsTest.php | 44 +++++----------------- core/modules/system/theme.api.php | 5 +-- .../Core/Asset/LibraryDiscoveryParserTest.php | 1 - 3 files changed, 11 insertions(+), 39 deletions(-) diff --git a/core/modules/system/src/Tests/Common/AttachedAssetsTest.php b/core/modules/system/src/Tests/Common/AttachedAssetsTest.php index d8078f4..fd44155 100644 --- a/core/modules/system/src/Tests/Common/AttachedAssetsTest.php +++ b/core/modules/system/src/Tests/Common/AttachedAssetsTest.php @@ -15,7 +15,7 @@ /** * Tests #attached assets: attached asset libraries and JavaScript settings. * - * i.e. tests + * i.e. tests: * * @code * $build['#attached']['library'] = … @@ -28,33 +28,19 @@ class AttachedAssetsTest extends KernelTestBase { /** - * Enable Language and SimpleTest in the test environment. - * - * @var array + * {@inheritdoc} */ public static $modules = array('language', 'simpletest', 'common_test', 'system'); /** - * Stores configured value for CSS preprocessing. - */ - protected $preprocess_css = NULL; - - /** - * Stores configured value for JavaScript preprocessing. - */ - protected $preprocess_js = NULL; - - /** * {@inheritdoc} */ protected function setUp() { parent::setUp(); - // Disable preprocessing - $config = \Drupal::config('system.performance'); - $this->preprocess_css = $config->get('js.preprocess'); - $this->preprocess_js = $config->get('js.preprocess'); - $config->set('css.preprocess', FALSE) + // Disable preprocessing. + \Drupal::config('system.performance') + ->set('css.preprocess', FALSE) ->set('js.preprocess', FALSE) ->save(); @@ -67,18 +53,7 @@ protected function setUp() { } /** - * {@inheritdoc} - */ - protected function tearDown() { - // Restore configured value for JavaScript preprocessing. - $config = \Drupal::config('system.performance'); - $config->set('js.preprocess', $this->preprocess_js); - $config->save(); - parent::tearDown(); - } - - /** - * Tests that default JavaScript is empty. + * Tests that default CSS and JavaScript is empty. */ function testDefault() { $build['#attached'] = []; @@ -121,7 +96,7 @@ function testAddFiles() { /** * Tests adding JavaScript settings. */ - function testAddJsSetting() { + function testAddJsSettings() { // Add a file in order to test default settings. $build['#attached']['library'][] = 'core/drupalSettings'; drupal_process_attached($build); @@ -152,7 +127,6 @@ function testAddExternalFiles() { $this->assertNotIdentical(strpos($rendered_js, ''), FALSE, 'Rendering an external JavaScript file.'); } - /** * Tests adding JavaScript files with additional attributes. */ @@ -233,7 +207,7 @@ function testFooterHTML() { } /** - * Tests _drupal_add_js() sets preproccess to FALSE when cache is also FALSE. + * Tests _drupal_add_js() sets preprocess to FALSE when cache is also FALSE. */ function testNoCache() { $build['#attached']['library'][] = 'common_test/no-cache'; @@ -401,7 +375,7 @@ function testLibraryAlter() { } /** - * Tests that multiple modules can implement the same library. + * Tests that multiple modules can implement libraries with the same name. * * @see common_test.library.yml */ diff --git a/core/modules/system/theme.api.php b/core/modules/system/theme.api.php index dcd30e8..24a4cf4 100644 --- a/core/modules/system/theme.api.php +++ b/core/modules/system/theme.api.php @@ -287,18 +287,17 @@ * @section sec_attached Attaching libraries in render arrays * * - * * Libraries, JavaScript settings, feeds, HTML tags and HTML links + * Libraries, JavaScript settings, feeds, HTML tags and HTML links * are attached to elements using the #attached property. The #attached property * is an associative array, where the keys are the the attachment types and the * values are the attached data. For example: - * * The #attached property allows loading of asset libraries (which may contain * CSS assets, JavaScript assets, and JavaScript setting assets), JavaScript * settings, feeds, HTML tags and HTML links. Specify an array of * type => value pairs, where the type (most often 'library' — for libraries, or * 'drupalSettings' — for JavaScript settings) to attach these response-level - * values.Example: + * values. Example: * @code * $build['#attached']['library'][] = 'core/jquery'; * $build['#attached']['drupalSettings']['foo] = 'bar'; diff --git a/core/tests/Drupal/Tests/Core/Asset/LibraryDiscoveryParserTest.php b/core/tests/Drupal/Tests/Core/Asset/LibraryDiscoveryParserTest.php index 8f6db0f..18e8bbc 100644 --- a/core/tests/Drupal/Tests/Core/Asset/LibraryDiscoveryParserTest.php +++ b/core/tests/Drupal/Tests/Core/Asset/LibraryDiscoveryParserTest.php @@ -206,7 +206,6 @@ public function testVersion() { $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']); - } /**