function SmartDefaultSettingsTest::testCandidates

Same name and namespace in other branches
  1. 9 core/modules/ckeditor5/tests/src/Unit/SmartDefaultSettingsTest.php \Drupal\Tests\ckeditor5\Unit\SmartDefaultSettingsTest::testCandidates()
  2. 10 core/modules/ckeditor5/tests/src/Unit/SmartDefaultSettingsTest.php \Drupal\Tests\ckeditor5\Unit\SmartDefaultSettingsTest::testCandidates()

@covers ::getCandidates @covers ::selectCandidate @dataProvider providerCandidates

File

core/modules/ckeditor5/tests/src/Unit/SmartDefaultSettingsTest.php, line 88

Class

SmartDefaultSettingsTest
@coversDefaultClass <a href="/api/drupal/core%21modules%21ckeditor5%21src%21SmartDefaultSettings.php/class/SmartDefaultSettings/11.x" title="Generates CKEditor 5 settings for existing text editors/formats." class="local">\Drupal\ckeditor5\SmartDefaultSettings</a> @group ckeditor5

Namespace

Drupal\Tests\ckeditor5\Unit

Code

public function testCandidates(HTMLRestrictions $provided, HTMLRestrictions $still_needed, array $disabled_plugin_definitions, array $expected_candidates, array $expected_selection = []) : void {
    $get_candidates = self::getMethod(SmartDefaultSettings::class, 'getCandidates');
    $smart_default_settings = new SmartDefaultSettings($this->prophesize(CKEditor5PluginManagerInterface::class)
        ->reveal(), $this->prophesize(LoggerInterface::class)
        ->reveal(), $this->prophesize(ModuleHandlerInterface::class)
        ->reveal(), $this->prophesize(AccountInterface::class)
        ->reveal());
    $editor = $this->prophesize(EditorInterface::class);
    $this->assertSame($expected_candidates, $get_candidates->invoke($smart_default_settings, $provided, $still_needed, $disabled_plugin_definitions, $editor->reveal()));
    $select_candidate = self::getMethod(SmartDefaultSettings::class, 'selectCandidate');
    $this->assertSame($expected_selection, $select_candidate->invoke(NULL, $expected_candidates, $still_needed, array_keys($provided->getAllowedElements())));
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.