function EntityUnitTest::testIsNew
Same name in other branches
- 9 core/tests/Drupal/Tests/Core/Entity/EntityUnitTest.php \Drupal\Tests\Core\Entity\EntityUnitTest::testIsNew()
- 8.9.x core/tests/Drupal/Tests/Core/Entity/EntityUnitTest.php \Drupal\Tests\Core\Entity\EntityUnitTest::testIsNew()
- 11.x core/tests/Drupal/Tests/Core/Entity/EntityUnitTest.php \Drupal\Tests\Core\Entity\EntityUnitTest::testIsNew()
@covers ::isNew @covers ::enforceIsNew
File
-
core/
tests/ Drupal/ Tests/ Core/ Entity/ EntityUnitTest.php, line 151
Class
- EntityUnitTest
- @coversDefaultClass \Drupal\Core\Entity\EntityBase @group Entity @group Access
Namespace
Drupal\Tests\Core\EntityCode
public function testIsNew() : void {
// We provided an ID, so the entity is not new.
$this->assertFalse($this->entity
->isNew());
// Force it to be new.
$this->assertSame($this->entity, $this->entity
->enforceIsNew());
$this->assertTrue($this->entity
->isNew());
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.