class LanguageTest

Same name in this branch
  1. 9 core/modules/language/tests/src/Kernel/Plugin/migrate/source/LanguageTest.php \Drupal\Tests\language\Kernel\Plugin\migrate\source\LanguageTest
  2. 9 core/modules/ckeditor5/tests/src/FunctionalJavascript/LanguageTest.php \Drupal\Tests\ckeditor5\FunctionalJavascript\LanguageTest
  3. 9 core/modules/ckeditor5/tests/src/Kernel/LanguageTest.php \Drupal\Tests\ckeditor5\Kernel\LanguageTest
Same name in other branches
  1. 8.9.x core/modules/language/tests/src/Kernel/Plugin/migrate/source/LanguageTest.php \Drupal\Tests\language\Kernel\Plugin\migrate\source\LanguageTest
  2. 8.9.x core/modules/ckeditor/tests/src/Unit/Plugin/CKEditorPlugin/LanguageTest.php \Drupal\Tests\ckeditor\Unit\Plugin\CKEditorPlugin\LanguageTest
  3. 10 core/modules/language/tests/src/Kernel/Plugin/migrate/source/LanguageTest.php \Drupal\Tests\language\Kernel\Plugin\migrate\source\LanguageTest
  4. 10 core/modules/ckeditor5/tests/src/FunctionalJavascript/LanguageTest.php \Drupal\Tests\ckeditor5\FunctionalJavascript\LanguageTest
  5. 10 core/modules/ckeditor5/tests/src/Kernel/LanguageTest.php \Drupal\Tests\ckeditor5\Kernel\LanguageTest
  6. 11.x core/modules/language/tests/src/Kernel/Plugin/migrate/source/LanguageTest.php \Drupal\Tests\language\Kernel\Plugin\migrate\source\LanguageTest
  7. 11.x core/modules/ckeditor5/tests/src/FunctionalJavascript/LanguageTest.php \Drupal\Tests\ckeditor5\FunctionalJavascript\LanguageTest
  8. 11.x core/modules/ckeditor5/tests/src/Kernel/LanguageTest.php \Drupal\Tests\ckeditor5\Kernel\LanguageTest

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

@group ckeditor @group legacy

Hierarchy

  • class \Drupal\Tests\UnitTestCase extends \PHPUnit\Framework\TestCase uses \Drupal\Tests\Traits\PhpUnitWarnings, \Drupal\Tests\PhpUnitCompatibilityTrait, \Symfony\Bridge\PhpUnit\ExpectDeprecationTrait
    • class \Drupal\Tests\ckeditor\Unit\Plugin\CKEditorPlugin\LanguageTest extends \Drupal\Tests\UnitTestCase

Expanded class hierarchy of LanguageTest

File

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

Namespace

Drupal\Tests\ckeditor\Unit\Plugin\CKEditorPlugin
View source
class LanguageTest extends UnitTestCase {
    
    /**
     * The plugin under test.
     *
     * @var \Drupal\ckeditor\Plugin\CKEditorPlugin\Language
     */
    protected $plugin;
    
    /**
     * {@inheritdoc}
     */
    public function setUp() : void {
        $this->plugin = new Language([], $this->randomMachineName(), []);
    }
    
    /**
     * Provides a list of configs to test.
     */
    public function providerGetConfig() {
        return [
            [
                'un',
                LanguageManager::getUnitedNationsLanguageList(),
            ],
            [
                'all',
                LanguageManager::getStandardLanguageList(),
            ],
        ];
    }
    
    /**
     * @covers ::getConfig
     *
     * @dataProvider providerGetConfig
     */
    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']);
    }

}

Members

Title Sort descending Deprecated Modifiers Object type Summary Overriden Title Overrides
LanguageTest::$plugin protected property The plugin under test.
LanguageTest::providerGetConfig public function Provides a list of configs to test.
LanguageTest::setUp public function Overrides UnitTestCase::setUp
LanguageTest::testGetConfig public function @covers ::getConfig
PhpUnitWarnings::$deprecationWarnings private static property Deprecation warnings from PHPUnit to raise with @trigger_error().
PhpUnitWarnings::addWarning public function Converts PHPUnit deprecation warnings to E_USER_DEPRECATED.
UnitTestCase::$randomGenerator protected property The random generator.
UnitTestCase::$root protected property The app root. 1
UnitTestCase::assertArrayEquals Deprecated protected function Asserts if two arrays are equal by sorting them first.
UnitTestCase::getClassResolverStub protected function Returns a stub class resolver.
UnitTestCase::getConfigFactoryStub public function Returns a stub config factory that behaves according to the passed array.
UnitTestCase::getConfigStorageStub public function Returns a stub config storage that returns the supplied configuration.
UnitTestCase::getContainerWithCacheTagsInvalidator protected function Sets up a container with a cache tags invalidator.
UnitTestCase::getRandomGenerator protected function Gets the random generator for the utility methods.
UnitTestCase::getStringTranslationStub public function Returns a stub translation manager that just returns the passed string.
UnitTestCase::randomMachineName public function Generates a unique random string containing letters and numbers.
UnitTestCase::setUpBeforeClass public static function

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