function LanguageTest::testGetConfig

Same name in other branches
  1. 8.9.x core/modules/ckeditor/tests/src/Unit/Plugin/CKEditorPlugin/LanguageTest.php \Drupal\Tests\ckeditor\Unit\Plugin\CKEditorPlugin\LanguageTest::testGetConfig()

@covers ::getConfig

@dataProvider providerGetConfig

File

core/modules/ckeditor/tests/src/Unit/Plugin/CKEditorPlugin/LanguageTest.php, line 46

Class

LanguageTest
@coversDefaultClass \Drupal\ckeditor\Plugin\CKEditorPlugin\Language

Namespace

Drupal\Tests\ckeditor\Unit\Plugin\CKEditorPlugin

Code

public function testGetConfig($language_list, $expected_languages) {
    $editor = $this->getMockBuilder('Drupal\\editor\\Entity\\Editor')
        ->disableOriginalConstructor()
        ->getMock();
    $editor->expects($this->once())
        ->method('getSettings')
        ->willReturn([
        'plugins' => [
            'language' => [
                'language_list' => $language_list,
            ],
        ],
    ]);
    $config = $this->plugin
        ->getConfig($editor);
    $this->assertIsArray($config);
    $this->assertContains('ar:Arabic:rtl', $config['language_list']);
    $this->assertContains('zh-hans:Chinese, Simplified', $config['language_list']);
    $this->assertContains('en:English', $config['language_list']);
    $this->assertContains('fr:French', $config['language_list']);
    $this->assertContains('ru:Russian', $config['language_list']);
    $this->assertContains('ar:Arabic:rtl', $config['language_list']);
    $this->assertSameSize($expected_languages, $config['language_list']);
}

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