function EntityFieldValueTraitTest::testGetFieldValueConsistencyWithTraditionalAccess
Same name and namespace in other branches
- main core/tests/Drupal/KernelTests/Core/Entity/EntityFieldValueTraitTest.php \Drupal\KernelTests\Core\Entity\EntityFieldValueTraitTest::testGetFieldValueConsistencyWithTraditionalAccess()
Tests getFieldValue() consistency with traditional access.
File
-
core/
tests/ Drupal/ KernelTests/ Core/ Entity/ EntityFieldValueTraitTest.php, line 122
Class
- EntityFieldValueTraitTest
- Tests the EntityFieldValueTrait.
Namespace
Drupal\KernelTests\Core\EntityCode
public function testGetFieldValueConsistencyWithTraditionalAccess() : void {
$account = User::create([
'name' => 'user1',
'mail' => 'consistency@example.com',
'status' => 1,
]);
$account->save();
$account = User::load($account->id());
assert($account instanceof User);
$this->assertSame($account->get('name')->value, $this->getFieldValue($account, 'name', 'value'));
$this->assertSame($account->get('mail')->value, $this->getFieldValue($account, 'mail', 'value'));
$this->assertSame($account->get('status')->value, $this->getFieldValue($account, 'status', 'value'));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.