public function ConfigEntityBaseUnitTest::testGetOriginalId in Drupal 10
Same name and namespace in other branches
- 8 core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityBaseUnitTest.php \Drupal\Tests\Core\Config\Entity\ConfigEntityBaseUnitTest::testGetOriginalId()
- 9 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 391 - Contains \Drupal\Tests\Core\Config\Entity\ConfigEntityBaseUnitTest.
Class
- ConfigEntityBaseUnitTest
- @coversDefaultClass \Drupal\Core\Config\Entity\ConfigEntityBase @group Config
Namespace
Drupal\Tests\Core\Config\EntityCode
public function testGetOriginalId() {
$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());
}