function ConfigMapperManagerTest::providerTestHasTranslatable

Same name in other branches
  1. 9 core/modules/config_translation/tests/src/Unit/ConfigMapperManagerTest.php \Drupal\Tests\config_translation\Unit\ConfigMapperManagerTest::providerTestHasTranslatable()
  2. 8.9.x core/modules/config_translation/tests/src/Unit/ConfigMapperManagerTest.php \Drupal\Tests\config_translation\Unit\ConfigMapperManagerTest::providerTestHasTranslatable()
  3. 10 core/modules/config_translation/tests/src/Unit/ConfigMapperManagerTest.php \Drupal\Tests\config_translation\Unit\ConfigMapperManagerTest::providerTestHasTranslatable()

Provides data for ConfigMapperManager::testHasTranslatable()

Return value

array An array of arrays, where each inner array contains the schema element to test as the first key and the expected result of ConfigMapperManager::hasTranslatable() as the second key.

File

core/modules/config_translation/tests/src/Unit/ConfigMapperManagerTest.php, line 94

Class

ConfigMapperManagerTest
Tests the functionality provided by configuration translation mapper manager.

Namespace

Drupal\Tests\config_translation\Unit

Code

public static function providerTestHasTranslatable() {
    return [
        [
            static::getElement([]),
            FALSE,
        ],
        [
            static::getElement([
                'aaa' => 'bbb',
            ]),
            FALSE,
        ],
        [
            static::getElement([
                'translatable' => FALSE,
            ]),
            FALSE,
        ],
        [
            static::getElement([
                'translatable' => TRUE,
            ]),
            TRUE,
        ],
        [
            static::getNestedElement([
                static::getElement([]),
            ]),
            FALSE,
        ],
        [
            static::getNestedElement([
                static::getElement([
                    'translatable' => TRUE,
                ]),
            ]),
            TRUE,
        ],
        [
            static::getNestedElement([
                static::getElement([
                    'aaa' => 'bbb',
                ]),
                static::getElement([
                    'ccc' => 'ddd',
                ]),
                static::getElement([
                    'eee' => 'fff',
                ]),
            ]),
            FALSE,
        ],
        [
            static::getNestedElement([
                static::getElement([
                    'aaa' => 'bbb',
                ]),
                static::getElement([
                    'ccc' => 'ddd',
                ]),
                static::getElement([
                    'translatable' => TRUE,
                ]),
            ]),
            TRUE,
        ],
        [
            static::getNestedElement([
                static::getElement([
                    'aaa' => 'bbb',
                ]),
                static::getNestedElement([
                    static::getElement([
                        'ccc' => 'ddd',
                    ]),
                    static::getElement([
                        'eee' => 'fff',
                    ]),
                ]),
                static::getNestedElement([
                    static::getElement([
                        'ggg' => 'hhh',
                    ]),
                    static::getElement([
                        'iii' => 'jjj',
                    ]),
                ]),
            ]),
            FALSE,
        ],
        [
            static::getNestedElement([
                static::getElement([
                    'aaa' => 'bbb',
                ]),
                static::getNestedElement([
                    static::getElement([
                        'ccc' => 'ddd',
                    ]),
                    static::getElement([
                        'eee' => 'fff',
                    ]),
                ]),
                static::getNestedElement([
                    static::getElement([
                        'ggg' => 'hhh',
                    ]),
                    static::getElement([
                        'translatable' => TRUE,
                    ]),
                ]),
            ]),
            TRUE,
        ],
    ];
}

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