public function CKEditor4to5UpgradeCompletenessTest::testButtons in Drupal 10
Tests that all CKEditor 4 buttons in core have an upgrade path.
File
- core/
modules/ ckeditor5/ tests/ src/ Kernel/ CKEditor4to5UpgradeCompletenessTest.php, line 103
Class
- CKEditor4to5UpgradeCompletenessTest
- @covers \Drupal\ckeditor5\Plugin\CKEditor4To5Upgrade\Core @group ckeditor5 @internal
Namespace
Drupal\Tests\ckeditor5\KernelCode
public function testButtons() : void {
$cke4_buttons = array_keys(NestedArray::mergeDeepArray($this->cke4PluginManager
->getButtons()));
$cke4_buttons = array_merge($cke4_buttons, self::CONTRIB_BUTTONS_NOW_IN_CORE);
foreach ($cke4_buttons as $button) {
$equivalent = $this->upgradePluginManager
->mapCKEditor4ToolbarButtonToCKEditor5ToolbarItem($button, HTMLRestrictions::emptySet());
$this
->assertTrue($equivalent === NULL || is_array($equivalent) && Inspector::assertAllStrings($equivalent));
// The returned equivalent CKEditor 5 toolbar item(s) must exist.
if (is_string($equivalent)) {
foreach (explode(',', $equivalent) as $equivalent_cke5_toolbar_item) {
$this
->assertArrayHasKey($equivalent_cke5_toolbar_item, $this->cke5PluginManager
->getToolbarItems());
}
}
}
}