class ConfigTest

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

Tests the Config.

@coversDefaultClass \Drupal\Core\Config\Config

@group Config

Hierarchy

Expanded class hierarchy of ConfigTest

See also

\Drupal\Core\Config\Config

File

core/tests/Drupal/Tests/Core/Config/ConfigTest.php, line 22

Namespace

Drupal\Tests\Core\Config
View source
class ConfigTest extends UnitTestCase {
    
    /**
     * Config.
     *
     * @var \Drupal\Core\Config\Config
     */
    protected $config;
    
    /**
     * Storage.
     *
     * @var \Drupal\Core\Config\StorageInterface|\PHPUnit\Framework\MockObject\MockObject
     */
    protected $storage;
    
    /**
     * Event Dispatcher.
     *
     * @var \Symfony\Contracts\EventDispatcher\EventDispatcherInterface|\PHPUnit\Framework\MockObject\MockObject
     */
    protected $eventDispatcher;
    
    /**
     * Typed Config.
     *
     * @var \Drupal\Core\Config\TypedConfigManagerInterface|\PHPUnit\Framework\MockObject\MockObject
     */
    protected $typedConfig;
    
    /**
     * The mocked cache tags invalidator.
     *
     * @var \Drupal\Core\Cache\CacheTagsInvalidatorInterface|\PHPUnit\Framework\MockObject\MockObject
     */
    protected $cacheTagsInvalidator;
    
    /**
     * {@inheritdoc}
     */
    protected function setUp() : void {
        parent::setUp();
        $this->storage = $this->createMock('Drupal\\Core\\Config\\StorageInterface');
        $this->eventDispatcher = $this->createMock('Symfony\\Contracts\\EventDispatcher\\EventDispatcherInterface');
        $this->typedConfig = $this->createMock('\\Drupal\\Core\\Config\\TypedConfigManagerInterface');
        $this->config = new Config('config.test', $this->storage, $this->eventDispatcher, $this->typedConfig);
        $this->cacheTagsInvalidator = $this->createMock('Drupal\\Core\\Cache\\CacheTagsInvalidatorInterface');
        $container = new ContainerBuilder();
        $container->set('cache_tags.invalidator', $this->cacheTagsInvalidator);
        \Drupal::setContainer($container);
    }
    
    /**
     * @covers ::setName
     * @dataProvider setNameProvider
     */
    public function testSetName($name) : void {
        // Set the name.
        $this->config
            ->setName($name);
        // Check that the name has been set correctly.
        $this->assertEquals($name, $this->config
            ->getName());
        // Check that the name validates.
        // Should throw \Drupal\Core\Config\ConfigNameException if invalid.
        $this->config
            ->validateName($name);
    }
    
    /**
     * Provides config names to test.
     *
     * @see \Drupal\Tests\Core\Config\ConfigTest::testSetName()
     */
    public static function setNameProvider() {
        return [
            // Valid name with dot.
[
                'test.name',
            ],
            // Maximum length.
[
                'test.' . str_repeat('a', Config::MAX_NAME_LENGTH - 5),
            ],
        ];
    }
    
    /**
     * @covers ::isNew
     */
    public function testIsNew() : void {
        // Config should be new by default.
        $this->assertTrue($this->config
            ->isNew());
        // Config is no longer new once saved.
        $this->config
            ->save();
        $this->assertFalse($this->config
            ->isNew());
    }
    
    /**
     * @covers ::setData
     * @dataProvider nestedDataProvider
     */
    public function testSetData($data) : void {
        $this->config
            ->setData($data);
        $this->assertEquals($data, $this->config
            ->getRawData());
        $this->assertConfigDataEquals($data);
    }
    
    /**
     * @covers ::save
     * @dataProvider nestedDataProvider
     */
    public function testSaveNew($data) : void {
        $this->cacheTagsInvalidator
            ->expects($this->never())
            ->method('invalidateTags');
        // Set initial data.
        $this->config
            ->setData($data);
        // Check that original data has not been set yet.
        foreach ($data as $key => $value) {
            $this->assertNull($this->config
                ->getOriginal($key, FALSE));
        }
        // Save so that the original data is set.
        $config = $this->config
            ->save();
        // Check that returned $config is instance of Config.
        $this->assertInstanceOf('\\Drupal\\Core\\Config\\Config', $config);
        // Check that the original data it saved.
        $this->assertOriginalConfigDataEquals($data, TRUE);
    }
    
    /**
     * @covers ::save
     * @dataProvider nestedDataProvider
     */
    public function testSaveExisting($data) : void {
        $this->cacheTagsInvalidator
            ->expects($this->once())
            ->method('invalidateTags')
            ->with([
            'config:config.test',
        ]);
        // Set initial data.
        $this->config
            ->setData($data);
        $this->config
            ->save();
        // Update.
        $new_data = $data;
        $new_data['a']['d'] = 2;
        $this->config
            ->setData($new_data);
        $this->config
            ->save();
        $this->assertOriginalConfigDataEquals($new_data, TRUE);
    }
    
    /**
     * @covers ::setModuleOverride
     * @covers ::setSettingsOverride
     * @covers ::getOriginal
     * @covers ::hasOverrides
     * @dataProvider overrideDataProvider
     */
    public function testOverrideData($data, $module_data, $setting_data) : void {
        // Set initial data.
        $this->config
            ->setData($data);
        // Check original data was set correctly.
        $this->assertConfigDataEquals($data);
        // Save so that the original data is stored.
        $this->config
            ->save();
        $this->assertFalse($this->config
            ->hasOverrides());
        $this->assertOverriddenKeys($data, []);
        // Set module override data and check value before and after save.
        $this->config
            ->setModuleOverride($module_data);
        $this->assertConfigDataEquals($module_data);
        $this->assertOverriddenKeys($data, $module_data);
        $this->config
            ->save();
        $this->assertConfigDataEquals($module_data);
        $this->assertOverriddenKeys($data, $module_data);
        // Reset the module overrides.
        $this->config
            ->setModuleOverride([]);
        $this->assertOverriddenKeys($data, []);
        // Set setting override data and check value before and after save.
        $this->config
            ->setSettingsOverride($setting_data);
        $this->assertConfigDataEquals($setting_data);
        $this->assertOverriddenKeys($data, $setting_data);
        $this->config
            ->save();
        $this->assertConfigDataEquals($setting_data);
        $this->assertOverriddenKeys($data, $setting_data);
        // Set module overrides again to ensure override order is correct.
        $this->config
            ->setModuleOverride($module_data);
        $merged_overrides = array_merge($module_data, $setting_data);
        // Setting data should be overriding module data.
        $this->assertConfigDataEquals($setting_data);
        $this->assertOverriddenKeys($data, $merged_overrides);
        $this->config
            ->save();
        $this->assertConfigDataEquals($setting_data);
        $this->assertOverriddenKeys($data, $merged_overrides);
        // Check original data has not changed.
        $this->assertOriginalConfigDataEquals($data, FALSE);
        // Check setting overrides are returned with $apply_overrides = TRUE.
        $this->assertOriginalConfigDataEquals($setting_data, TRUE);
        // Check that $apply_overrides defaults to TRUE.
        foreach ($setting_data as $key => $value) {
            $config_value = $this->config
                ->getOriginal($key);
            $this->assertEquals($value, $config_value);
        }
        // Check that the overrides can be completely reset.
        $this->config
            ->setModuleOverride([]);
        $this->config
            ->setSettingsOverride([]);
        $this->assertConfigDataEquals($data);
        $this->assertOverriddenKeys($data, []);
        $this->config
            ->save();
        $this->assertConfigDataEquals($data);
        $this->assertOverriddenKeys($data, []);
    }
    
    /**
     * @covers ::set
     * @dataProvider nestedDataProvider
     */
    public function testSetValue($data) : void {
        foreach ($data as $key => $value) {
            $this->config
                ->set($key, $value);
        }
        $this->assertConfigDataEquals($data);
    }
    
    /**
     * @covers ::set
     */
    public function testSetValidation() : void {
        $this->expectException(ConfigValueException::class);
        $this->config
            ->set('testData', [
            'dot.key' => 1,
        ]);
    }
    
    /**
     * @covers ::set
     */
    public function testSetIllegalOffsetValue() : void {
        // Set a single value.
        $this->config
            ->set('testData', 1);
        // Attempt to treat the single value as a nested item.
        $this->expectException(\LogicException::class);
        $this->expectExceptionMessage('Cannot create key "illegalOffset" on non-array value.');
        $this->config
            ->set('testData.illegalOffset', 1);
    }
    
    /**
     * @covers ::initWithData
     * @dataProvider nestedDataProvider
     */
    public function testInitWithData($data) : void {
        $config = $this->config
            ->initWithData($data);
        // Should return the Config object.
        $this->assertInstanceOf('\\Drupal\\Core\\Config\\Config', $config);
        // Check config is not new.
        $this->assertEquals(FALSE, $this->config
            ->isNew());
        // Check that data value was set correctly.
        $this->assertConfigDataEquals($data);
        // Check that original data was set.
        $this->assertOriginalConfigDataEquals($data, TRUE);
        // Check without applying overrides.
        $this->assertOriginalConfigDataEquals($data, FALSE);
    }
    
    /**
     * @covers ::clear
     * @dataProvider simpleDataProvider
     */
    public function testClear($data) : void {
        foreach ($data as $key => $value) {
            // Check that values are cleared.
            $this->config
                ->set($key, $value);
            $this->assertEquals($value, $this->config
                ->get($key));
            $this->config
                ->clear($key);
            $this->assertNull($this->config
                ->get($key));
        }
    }
    
    /**
     * @covers ::clear
     * @dataProvider nestedDataProvider
     */
    public function testNestedClear($data) : void {
        foreach ($data as $key => $value) {
            // Check that values are cleared.
            $this->config
                ->set($key, $value);
            // Check each nested value.
            foreach ($value as $nested_key => $nested_value) {
                $full_nested_key = $key . '.' . $nested_key;
                $this->assertEquals($nested_value, $this->config
                    ->get($full_nested_key));
                $this->config
                    ->clear($full_nested_key);
                $this->assertNull($this->config
                    ->get($full_nested_key));
            }
        }
    }
    
    /**
     * @covers ::delete
     * @dataProvider overrideDataProvider
     */
    public function testDelete($data, $module_data) : void {
        $this->cacheTagsInvalidator
            ->expects($this->once())
            ->method('invalidateTags')
            ->with([
            'config:config.test',
        ]);
        // Set initial data.
        foreach ($data as $key => $value) {
            $this->config
                ->set($key, $value);
        }
        // Set overrides.
        $this->config
            ->setModuleOverride($module_data);
        // Save.
        $this->config
            ->save();
        // Check that original data is still correct.
        $this->assertOriginalConfigDataEquals($data, FALSE);
        // Check overrides have been set.
        $this->assertConfigDataEquals($module_data);
        $this->assertOriginalConfigDataEquals($module_data, TRUE);
        // Check that config is new.
        $this->assertFalse($this->config
            ->isNew());
        // Delete.
        $this->config
            ->delete();
        // Check object properties have been reset.
        $this->assertTrue($this->config
            ->isNew());
        foreach ($data as $key => $value) {
            $this->assertEmpty($this->config
                ->getOriginal($key, FALSE));
        }
        // Check that overrides have persisted.
        foreach ($module_data as $key => $value) {
            $this->assertConfigDataEquals($module_data);
            $this->assertOriginalConfigDataEquals($module_data, TRUE);
        }
    }
    
    /**
     * @covers ::merge
     * @dataProvider mergeDataProvider
     */
    public function testMerge($data, $data_to_merge, $merged_data) : void {
        // Set initial data.
        $this->config
            ->setData($data);
        // Data to merge.
        $this->config
            ->merge($data_to_merge);
        // Check that data has merged correctly.
        $this->assertEquals($merged_data, $this->config
            ->getRawData());
    }
    
    /**
     * Provides data to test merges.
     *
     * @see \Drupal\Tests\Core\Config\ConfigTest::testMerge()
     */
    public static function mergeDataProvider() {
        return [
            [
                // Data.
[
                    'a' => 1,
                    'b' => 2,
                    'c' => [
                        'd' => 3,
                    ],
                ],
                // Data to merge.
[
                    'a' => 2,
                    'e' => 4,
                    'c' => [
                        'f' => 5,
                    ],
                ],
                // Data merged.
[
                    'a' => 2,
                    'b' => 2,
                    'c' => [
                        'd' => 3,
                        'f' => 5,
                    ],
                    'e' => 4,
                ],
            ],
        ];
    }
    
    /**
     * @covers ::validateName
     * @dataProvider validateNameProvider
     */
    public function testValidateNameException($name, $exception_message) : void {
        $this->expectException('\\Drupal\\Core\\Config\\ConfigNameException');
        $this->expectExceptionMessage($exception_message);
        $this->config
            ->validateName($name);
    }
    
    /**
     * @covers ::getCacheTags
     */
    public function testGetCacheTags() : void {
        $this->assertSame([
            'config:' . $this->config
                ->getName(),
        ], $this->config
            ->getCacheTags());
    }
    
    /**
     * Provides data to test name validation.
     *
     * @see \Drupal\Tests\Core\Config\ConfigTest::testValidateNameException()
     */
    public static function validateNameProvider() {
        $return = [
            // Name missing namespace (dot).
[
                'MissingNamespace',
                'Missing namespace in Config object name MissingNamespace.',
            ],
            // Exceeds length (max length plus an extra dot).
[
                str_repeat('a', Config::MAX_NAME_LENGTH) . ".",
                'Config object name ' . str_repeat('a', Config::MAX_NAME_LENGTH) . '. exceeds maximum allowed length of ' . Config::MAX_NAME_LENGTH . ' characters.',
            ],
        ];
        // Name must not contain : ? * < > " ' / \
        foreach ([
            ':',
            '?',
            '*',
            '<',
            '>',
            '"',
            "'",
            '/',
            '\\',
        ] as $char) {
            $name = 'name.' . $char;
            $return[] = [
                $name,
                "Invalid character in Config object name {$name}.",
            ];
        }
        return $return;
    }
    
    /**
     * Provides override data.
     *
     * @see \Drupal\Tests\Core\Config\ConfigTest::testOverrideData()
     * @see \Drupal\Tests\Core\Config\ConfigTest::testDelete()
     */
    public static function overrideDataProvider() {
        $test_cases = [
            [
                // Original data.
[
                    'a' => 'originalValue',
                ],
                // Module overrides.
[
                    'a' => 'moduleValue',
                ],
                // Setting overrides.
[
                    'a' => 'settingValue',
                ],
            ],
            [
                // Original data.
[
                    'a' => 'originalValue',
                    'b' => 'originalValue',
                    'c' => 'originalValue',
                ],
                // Module overrides.
[
                    'a' => 'moduleValue',
                    'b' => 'moduleValue',
                ],
                // Setting overrides.
[
                    'a' => 'settingValue',
                ],
            ],
            [
                // Original data.
[
                    'a' => 'allTheSameValue',
                ],
                // Module overrides.
[
                    'a' => 'allTheSameValue',
                ],
                // Setting overrides.
[
                    'a' => 'allTheSameValue',
                ],
            ],
        ];
        // For each of the above test cases create duplicate test case except with
        // config values nested.
        foreach ($test_cases as $test_key => $test_case) {
            foreach ($test_case as $parameter) {
                $nested_parameter = [];
                foreach ($parameter as $config_key => $value) {
                    // Nest config value 5 levels.
                    $nested_value = $value;
                    for ($i = 5; $i >= 0; $i--) {
                        $nested_value = [
                            $i => $nested_value,
                        ];
                    }
                    $nested_parameter[$config_key] = $nested_value;
                }
                $test_cases["nested:{$test_key}"][] = $nested_parameter;
            }
        }
        return $test_cases;
    }
    
    /**
     * Provides simple test data.
     *
     * @see \Drupal\Tests\Core\Config\ConfigTest::testClear()
     */
    public static function simpleDataProvider() {
        return [
            [
                [
                    'a' => '1',
                    'b' => '2',
                    'c' => '3',
                ],
            ],
        ];
    }
    
    /**
     * Provides nested test data.
     *
     * @see \Drupal\Tests\Core\Config\ConfigTest::testSetData()
     * @see \Drupal\Tests\Core\Config\ConfigTest::testSave()
     * @see \Drupal\Tests\Core\Config\ConfigTest::testSetValue()
     * @see \Drupal\Tests\Core\Config\ConfigTest::testInitWithData()
     * @see \Drupal\Tests\Core\Config\ConfigTest::testNestedClear()
     */
    public static function nestedDataProvider() {
        return [
            [
                [
                    'a' => [
                        'd' => 1,
                    ],
                    'b' => [
                        'e' => 2,
                    ],
                    'c' => [
                        'f' => 3,
                    ],
                ],
            ],
        ];
    }
    
    /**
     * Asserts all config data equals $data provided.
     *
     * @param array $data
     *   Config data to be checked.
     *
     * @internal
     */
    public function assertConfigDataEquals(array $data) : void {
        foreach ($data as $key => $value) {
            $this->assertEquals($value, $this->config
                ->get($key));
        }
    }
    
    /**
     * Asserts all original config data equals $data provided.
     *
     * @param array $data
     *   Config data to be checked.
     * @param bool $apply_overrides
     *   Apply any overrides to the original data.
     *
     * @internal
     */
    public function assertOriginalConfigDataEquals(array $data, bool $apply_overrides) : void {
        foreach ($data as $key => $value) {
            $config_value = $this->config
                ->getOriginal($key, $apply_overrides);
            $this->assertEquals($value, $config_value);
        }
    }
    
    /**
     * @covers ::setData
     * @covers ::set
     * @covers ::initWithData
     */
    public function testSafeStringHandling() : void {
        // Safe strings are cast when using ::set().
        $safe_string = Markup::create('bar');
        $this->config
            ->set('foo', $safe_string);
        $this->assertSame('bar', $this->config
            ->get('foo'));
        $this->config
            ->set('foo', [
            'bar' => $safe_string,
        ]);
        $this->assertSame('bar', $this->config
            ->get('foo.bar'));
        // Safe strings are cast when using ::setData().
        $this->config
            ->setData([
            'bar' => $safe_string,
        ]);
        $this->assertSame('bar', $this->config
            ->get('bar'));
        // Safe strings are not cast when using ::initWithData().
        $this->config
            ->initWithData([
            'bar' => $safe_string,
        ]);
        $this->assertSame($safe_string, $this->config
            ->get('bar'));
    }
    
    /**
     * Asserts that the correct keys are overridden.
     *
     * @param array $data
     *   The original data.
     * @param array $overridden_data
     *   The overridden data.
     *
     * @internal
     */
    protected function assertOverriddenKeys(array $data, array $overridden_data) : void {
        if (empty($overridden_data)) {
            $this->assertFalse($this->config
                ->hasOverrides());
        }
        else {
            $this->assertTrue($this->config
                ->hasOverrides());
            foreach ($overridden_data as $key => $value) {
                // If there are nested overrides test a keys at every level.
                if (is_array($value)) {
                    $nested_key = $key;
                    $nested_value = $overridden_data[$key];
                    while (is_array($nested_value)) {
                        $nested_key .= '.' . key($nested_value);
                        $this->assertTrue($this->config
                            ->hasOverrides($nested_key));
                        $nested_value = array_pop($nested_value);
                    }
                }
                $this->assertTrue($this->config
                    ->hasOverrides($key));
            }
        }
        $non_overridden_keys = array_diff(array_keys($data), array_keys($overridden_data));
        foreach ($non_overridden_keys as $non_overridden_key) {
            $this->assertFalse($this->config
                ->hasOverrides($non_overridden_key));
            // If there are nested overrides test keys at every level.
            if (is_array($data[$non_overridden_key])) {
                $nested_key = $non_overridden_key;
                $nested_value = $data[$non_overridden_key];
                while (is_array($nested_value)) {
                    $nested_key .= '.' . key($nested_value);
                    $this->assertFalse($this->config
                        ->hasOverrides($nested_key));
                    $nested_value = array_pop($nested_value);
                }
            }
        }
    }

}

Members

Title Sort descending Deprecated Modifiers Object type Summary Overriden Title Overrides
ConfigTest::$cacheTagsInvalidator protected property The mocked cache tags invalidator.
ConfigTest::$config protected property Config.
ConfigTest::$eventDispatcher protected property Event Dispatcher.
ConfigTest::$storage protected property Storage.
ConfigTest::$typedConfig protected property Typed Config.
ConfigTest::assertConfigDataEquals public function Asserts all config data equals $data provided.
ConfigTest::assertOriginalConfigDataEquals public function Asserts all original config data equals $data provided.
ConfigTest::assertOverriddenKeys protected function Asserts that the correct keys are overridden.
ConfigTest::mergeDataProvider public static function Provides data to test merges.
ConfigTest::nestedDataProvider public static function Provides nested test data.
ConfigTest::overrideDataProvider public static function Provides override data.
ConfigTest::setNameProvider public static function Provides config names to test.
ConfigTest::setUp protected function Overrides UnitTestCase::setUp
ConfigTest::simpleDataProvider public static function Provides simple test data.
ConfigTest::testClear public function @covers ::clear
@dataProvider simpleDataProvider
ConfigTest::testDelete public function @covers ::delete
@dataProvider overrideDataProvider
ConfigTest::testGetCacheTags public function @covers ::getCacheTags
ConfigTest::testInitWithData public function @covers ::initWithData
@dataProvider nestedDataProvider
ConfigTest::testIsNew public function @covers ::isNew
ConfigTest::testMerge public function @covers ::merge
@dataProvider mergeDataProvider
ConfigTest::testNestedClear public function @covers ::clear
@dataProvider nestedDataProvider
ConfigTest::testOverrideData public function @covers ::setModuleOverride
@covers ::setSettingsOverride
@covers ::getOriginal
@covers ::hasOverrides
@dataProvider overrideDataProvider
ConfigTest::testSafeStringHandling public function @covers ::setData
@covers ::set
@covers ::initWithData
ConfigTest::testSaveExisting public function @covers ::save
@dataProvider nestedDataProvider
ConfigTest::testSaveNew public function @covers ::save
@dataProvider nestedDataProvider
ConfigTest::testSetData public function @covers ::setData
@dataProvider nestedDataProvider
ConfigTest::testSetIllegalOffsetValue public function @covers ::set
ConfigTest::testSetName public function @covers ::setName
@dataProvider setNameProvider
ConfigTest::testSetValidation public function @covers ::set
ConfigTest::testSetValue public function @covers ::set
@dataProvider nestedDataProvider
ConfigTest::testValidateNameException public function @covers ::validateName
@dataProvider validateNameProvider
ConfigTest::validateNameProvider public static function Provides data to test name validation.
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.
RandomGeneratorTrait::getRandomGenerator protected function Gets the random generator for the utility methods.
RandomGeneratorTrait::randomMachineName protected function Generates a unique random string containing letters and numbers.
RandomGeneratorTrait::randomObject public function Generates a random PHP object.
RandomGeneratorTrait::randomString public function Generates a pseudo-random string of ASCII characters of codes 32 to 126.
RandomGeneratorTrait::randomStringValidate Deprecated public function Callback for random string validation.
UnitTestCase::$root protected property The app root. 1
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::getStringTranslationStub public function Returns a stub translation manager that just returns the passed string.
UnitTestCase::setUpBeforeClass public static function
UnitTestCase::__get public function

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