ConfigTest.php

Same filename in this branch
  1. 9 core/modules/config/tests/config_test/src/Entity/ConfigTest.php
  2. 9 core/modules/migrate/tests/src/Unit/destination/ConfigTest.php
  3. 9 core/modules/system/tests/src/Functional/File/ConfigTest.php
  4. 9 core/tests/Drupal/Tests/Composer/Plugin/ProjectMessage/ConfigTest.php
  5. 9 core/tests/Drupal/Tests/Composer/Plugin/VendorHardening/ConfigTest.php
  6. 9 core/tests/Drupal/Tests/Core/Config/ConfigTest.php
Same filename in other branches
  1. 8.9.x core/modules/migrate_drupal/tests/src/Kernel/Plugin/migrate/source/d8/ConfigTest.php
  2. 8.9.x core/modules/config/tests/config_test/src/Entity/ConfigTest.php
  3. 8.9.x core/modules/migrate/tests/src/Unit/destination/ConfigTest.php
  4. 8.9.x core/modules/system/tests/src/Functional/File/ConfigTest.php
  5. 8.9.x core/tests/Drupal/Tests/Composer/Plugin/ProjectMessage/ConfigTest.php
  6. 8.9.x core/tests/Drupal/Tests/Composer/Plugin/VendorHardening/ConfigTest.php
  7. 8.9.x core/tests/Drupal/Tests/Core/Config/ConfigTest.php
  8. 10 core/modules/migrate_drupal/tests/src/Kernel/Plugin/migrate/source/d8/ConfigTest.php
  9. 10 core/modules/config/tests/config_test/src/Entity/ConfigTest.php
  10. 10 core/modules/migrate/tests/src/Unit/destination/ConfigTest.php
  11. 10 core/modules/system/tests/src/Functional/File/ConfigTest.php
  12. 10 core/tests/Drupal/Tests/Composer/Plugin/ProjectMessage/ConfigTest.php
  13. 10 core/tests/Drupal/Tests/Composer/Plugin/VendorHardening/ConfigTest.php
  14. 10 core/tests/Drupal/Tests/Core/Config/ConfigTest.php
  15. 11.x core/modules/migrate_drupal/tests/src/Kernel/Plugin/migrate/source/d8/ConfigTest.php
  16. 11.x core/modules/config/tests/config_test/src/Entity/ConfigTest.php
  17. 11.x core/modules/migrate/tests/src/Unit/destination/ConfigTest.php
  18. 11.x core/modules/system/tests/src/Functional/File/ConfigTest.php
  19. 11.x core/tests/Drupal/Tests/Composer/Plugin/ProjectMessage/ConfigTest.php
  20. 11.x core/tests/Drupal/Tests/Composer/Plugin/VendorHardening/ConfigTest.php
  21. 11.x core/tests/Drupal/Tests/Core/Config/ConfigTest.php

Namespace

Drupal\Tests\migrate_drupal\Kernel\Plugin\migrate\source\d8

File

core/modules/migrate_drupal/tests/src/Kernel/Plugin/migrate/source/d8/ConfigTest.php

View source
<?php

namespace Drupal\Tests\migrate_drupal\Kernel\Plugin\migrate\source\d8;

use Drupal\Tests\migrate\Kernel\MigrateSqlSourceTestBase;

/**
 * Tests the config source plugin.
 *
 * @covers \Drupal\migrate_drupal\Plugin\migrate\source\d8\Config
 * @group migrate_drupal
 */
class ConfigTest extends MigrateSqlSourceTestBase {
    
    /**
     * {@inheritdoc}
     */
    protected static $modules = [
        'migrate_drupal',
    ];
    
    /**
     * {@inheritdoc}
     */
    public function providerSource() {
        $data = [];
        // The source database tables.
        $data[0]['source_data'] = [
            'config' => [
                [
                    'collection' => 'language.af',
                    'name' => 'user.settings',
                    'data' => 'a:1:{s:9:"anonymous";s:14:"af - Anonymous";}',
                ],
                [
                    'collection' => '',
                    'name' => 'user.settings',
                    'data' => 'a:1:{s:9:"anonymous";s:9:"Anonymous";}',
                ],
                [
                    'collection' => 'language.de',
                    'name' => 'user.settings',
                    'data' => 'a:1:{s:9:"anonymous";s:14:"de - Anonymous";}',
                ],
                [
                    'collection' => 'language.af',
                    'name' => 'bar',
                    'data' => 'b:0;',
                ],
            ],
        ];
        // The expected results.
        $data[0]['expected_results'] = [
            [
                'collection' => 'language.af',
                'name' => 'user.settings',
                'data' => [
                    'anonymous' => 'af - Anonymous',
                ],
            ],
            [
                'collection' => 'language.af',
                'name' => 'bar',
                'data' => FALSE,
            ],
        ];
        $data[0]['expected_count'] = NULL;
        $data[0]['configuration'] = [
            'names' => [
                'user.settings',
                'bar',
            ],
            'collections' => [
                'language.af',
            ],
        ];
        // Test with name and no collection in configuration.
        $data[1]['source_data'] = $data[0]['source_data'];
        $data[1]['expected_results'] = [
            [
                'collection' => 'language.af',
                'name' => 'bar',
                'data' => FALSE,
            ],
        ];
        $data[1]['expected_count'] = NULL;
        $data[1]['configuration'] = [
            'names' => [
                'bar',
            ],
        ];
        // Test with collection and no name in configuration.
        $data[2]['source_data'] = $data[0]['source_data'];
        $data[2]['expected_results'] = [
            [
                'collection' => 'language.de',
                'name' => 'user.settings',
                'data' => [
                    'anonymous' => 'de - Anonymous',
                ],
            ],
        ];
        $data[2]['expected_count'] = NULL;
        $data[2]['configuration'] = [
            'collections' => [
                'language.de',
            ],
        ];
        return $data;
    }

}

Classes

Title Deprecated Summary
ConfigTest Tests the config source plugin.

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