public function EntityFieldTest::testBaseFieldNonExistingBaseField in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/system/src/Tests/Entity/EntityFieldTest.php \Drupal\system\Tests\Entity\EntityFieldTest::testBaseFieldNonExistingBaseField()
Tests a base field override on a non-existing base field.
See also
entity_test_entity_base_field_info_alter()
File
- core/
modules/ system/ src/ Tests/ Entity/ EntityFieldTest.php, line 610 - Contains \Drupal\system\Tests\Entity\EntityFieldTest.
Class
- EntityFieldTest
- Tests the Entity Field API.
Namespace
Drupal\system\Tests\EntityCode
public function testBaseFieldNonExistingBaseField() {
$this->entityManager
->getStorage('node_type')
->create(array(
'type' => 'page',
'name' => 'page',
))
->save();
$this->entityManager
->clearCachedFieldDefinitions();
$fields = $this->entityManager
->getFieldDefinitions('node', 'page');
$override = $fields['status']
->getConfig('page');
$override
->setLabel($this
->randomString())
->save();
\Drupal::state()
->set('entity_test.node_remove_status_field', TRUE);
$this->entityManager
->clearCachedFieldDefinitions();
$fields = $this->entityManager
->getFieldDefinitions('node', 'page');
// A base field override on a non-existing base field should not cause a
// field definition to come into existence.
$this
->assertFalse(isset($fields['status']), 'Node\'s status base field does not exist.');
}