function ConfigEntityUnitTest::testTrustedDataDeprecations
Same name and namespace in other branches
- main core/tests/Drupal/KernelTests/Core/Config/ConfigEntityUnitTest.php \Drupal\KernelTests\Core\Config\ConfigEntityUnitTest::testTrustedDataDeprecations()
Tests the legacy trusted data behavior.
Attributes
#[IgnoreDeprecations]
File
-
core/
tests/ Drupal/ KernelTests/ Core/ Config/ ConfigEntityUnitTest.php, line 113
Class
- ConfigEntityUnitTest
- Unit tests for configuration entity base methods.
Namespace
Drupal\KernelTests\Core\ConfigCode
public function testTrustedDataDeprecations() : void {
$this->expectUserDeprecationMessage('Drupal\\Core\\Config\\Entity\\ConfigEntityBase::trustData() is deprecated in drupal:11.4.0 and is removed from drupal:13.0.0. There is no replacement. See https://www.drupal.org/node/3348180');
$this->expectUserDeprecationMessage('Calling Drupal\\Core\\Config\\Config::save() with the $has_trusted_data argument is deprecated in drupal:11.4.0 and is removed from drupal:13.0.0. There is no replacement. See https://www.drupal.org/node/3348180');
// Test that schema type enforcement.
$entity = $this->storage
->create([
'id' => $this->randomMachineName(),
'label' => $this->randomString(),
'style' => 999,
]);
$this->assertInstanceOf(ConfigEntityInterface::class, $entity);
$entity->trustData();
$this->assertTrue($entity->hasTrustedData());
$entity->save();
$this->assertFalse($entity->hasTrustedData());
$this->assertSame(999, $entity->style);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.