function EntityFieldValueTraitTest::testGetFieldValueWithDelta
Same name and namespace in other branches
- main core/tests/Drupal/KernelTests/Core/Entity/EntityFieldValueTraitTest.php \Drupal\KernelTests\Core\Entity\EntityFieldValueTraitTest::testGetFieldValueWithDelta()
Tests getFieldValue() with delta parameter.
File
-
core/
tests/ Drupal/ KernelTests/ Core/ Entity/ EntityFieldValueTraitTest.php, line 111
Class
- EntityFieldValueTraitTest
- Tests the EntityFieldValueTrait.
Namespace
Drupal\KernelTests\Core\EntityCode
public function testGetFieldValueWithDelta() : void {
$account = User::create([
'name' => 'user1',
]);
$account->save();
$this->assertSame('user1', $this->getFieldValue($account, 'name', 'value', 0));
$this->assertNull($this->getFieldValue($account, 'name', 'value', 1));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.