function CKEditor5StylesheetsTest::testExternalStylesheets
Same name and namespace in other branches
- 11.x core/modules/ckeditor5/tests/src/Kernel/CKEditor5StylesheetsTest.php \Drupal\Tests\ckeditor5\Kernel\CKEditor5StylesheetsTest::testExternalStylesheets()
- 10 core/modules/ckeditor5/tests/src/Kernel/CKEditor5StylesheetsTest.php \Drupal\Tests\ckeditor5\Kernel\CKEditor5StylesheetsTest::testExternalStylesheets()
- 9 core/modules/ckeditor5/tests/src/Kernel/CKEditor5StylesheetsTest.php \Drupal\Tests\ckeditor5\Kernel\CKEditor5StylesheetsTest::testExternalStylesheets()
Tests loading of theme's CKEditor 5 stylesheets defined in the .info file.
Attributes
#[DataProvider('externalStylesheetsProvider')]
Parameters
string $theme: The machine name of the theme.
array $expected: The expected CKEditor 5 CSS paths from the theme.
File
-
core/
modules/ ckeditor5/ tests/ src/ Kernel/ CKEditor5StylesheetsTest.php, line 38
Class
- CKEditor5StylesheetsTest
- Test the ckeditor5-stylesheets theme config property.
Namespace
Drupal\Tests\ckeditor5\KernelCode
public function testExternalStylesheets($theme, $expected) : void {
\Drupal::service('theme_installer')->install([
$theme,
]);
$this->config('system.theme')
->set('default', $theme)
->save();
// Access protected \Drupal\ckeditor5\Hook\Ckeditor5Hooks::themeCss() method
// so we can test it.
$hooks_service = $this->container
->get(Ckeditor5Hooks::class);
$class = new \ReflectionClass($hooks_service);
$theme_css_method = $class->getMethod('themeCss');
$this->assertSame($expected, $theme_css_method->invokeArgs($hooks_service, [
$theme,
]));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.