function ConfigEntityAdapterTest::testSet
Same name in other branches
- 8.9.x core/tests/Drupal/KernelTests/Core/Entity/ConfigEntityAdapterTest.php \Drupal\KernelTests\Core\Entity\ConfigEntityAdapterTest::testSet()
- 10 core/tests/Drupal/KernelTests/Core/Entity/ConfigEntityAdapterTest.php \Drupal\KernelTests\Core\Entity\ConfigEntityAdapterTest::testSet()
- 11.x core/tests/Drupal/KernelTests/Core/Entity/ConfigEntityAdapterTest.php \Drupal\KernelTests\Core\Entity\ConfigEntityAdapterTest::testSet()
@covers ::set
File
-
core/
tests/ Drupal/ KernelTests/ Core/ Entity/ ConfigEntityAdapterTest.php, line 119
Class
- ConfigEntityAdapterTest
- Tests entity adapter for configuration entities.
Namespace
Drupal\KernelTests\Core\EntityCode
public function testSet() {
$adapter = ConfigEntityAdapter::createFromEntity($this->entity);
// Get the value via typed data to ensure that the typed representation is
// updated correctly when the value is set.
$this->assertEquals(1, $adapter->get('weight')
->getValue());
$return = $adapter->set('weight', 2);
$this->assertSame($adapter, $return);
$this->assertEquals(2, $this->entity->weight);
// Ensure the typed data is updated via the set too.
$this->assertEquals(2, $adapter->get('weight')
->getValue());
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.