Commit 2d1e404b authored by catch's avatar catch

Issue #3046392 by claudiu.cristea: Convert LocaleLibraryAlterTest into a Kernel test

parent 2a6d8d71
<?php
namespace Drupal\Tests\locale\Functional;
namespace Drupal\Tests\locale\Kernel;
use Drupal\Core\Asset\AttachedAssets;
use Drupal\Tests\BrowserTestBase;
use Drupal\KernelTests\KernelTestBase;
/**
* Tests localization of the JavaScript libraries.
......@@ -12,14 +12,12 @@
*
* @group locale
*/
class LocaleLibraryAlterTest extends BrowserTestBase {
class LocaleLibraryAlterTest extends KernelTestBase {
/**
* Modules to enable.
*
* @var array
* {@inheritdoc}
*/
public static $modules = ['locale'];
protected static $modules = ['locale'];
/**
* Verifies that the datepicker can be localized.
......@@ -27,10 +25,15 @@ class LocaleLibraryAlterTest extends BrowserTestBase {
* @see locale_library_alter()
*/
public function testLibraryAlter() {
$this->installSchema('locale', [
'locales_location',
'locales_source',
]);
$assets = new AttachedAssets();
$assets->setLibraries(['core/jquery.ui.datepicker']);
$js_assets = $this->container->get('asset.resolver')->getJsAssets($assets, FALSE)[1];
$this->assertTrue(array_key_exists('core/modules/locale/locale.datepicker.js', $js_assets), 'locale.datepicker.js added to scripts.');
$this->assertArrayHasKey('core/modules/locale/locale.datepicker.js', $js_assets);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment