function ConfigEntityBaseUnitTest::testGetOriginalId
Same name in other branches
- 9 core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityBaseUnitTest.php \Drupal\Tests\Core\Config\Entity\ConfigEntityBaseUnitTest::testGetOriginalId()
- 8.9.x core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityBaseUnitTest.php \Drupal\Tests\Core\Config\Entity\ConfigEntityBaseUnitTest::testGetOriginalId()
- 11.x core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityBaseUnitTest.php \Drupal\Tests\Core\Config\Entity\ConfigEntityBaseUnitTest::testGetOriginalId()
@covers ::setOriginalId @covers ::getOriginalId
File
-
core/
tests/ Drupal/ Tests/ Core/ Config/ Entity/ ConfigEntityBaseUnitTest.php, line 396
Class
- ConfigEntityBaseUnitTest
- @coversDefaultClass \Drupal\Core\Config\Entity\ConfigEntityBase @group Config
Namespace
Drupal\Tests\Core\Config\EntityCode
public function testGetOriginalId() : void {
$new_id = $this->randomMachineName();
$this->entity
->set('id', $new_id);
$this->assertSame($this->id, $this->entity
->getOriginalId());
$this->assertSame($this->entity, $this->entity
->setOriginalId($new_id));
$this->assertSame($new_id, $this->entity
->getOriginalId());
// Check that setOriginalId() does not change the entity "isNew" status.
$this->assertFalse($this->entity
->isNew());
$this->entity
->setOriginalId($this->randomMachineName());
$this->assertFalse($this->entity
->isNew());
$this->entity
->enforceIsNew();
$this->assertTrue($this->entity
->isNew());
$this->entity
->setOriginalId($this->randomMachineName());
$this->assertTrue($this->entity
->isNew());
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.