function EntityFieldValueTraitTest::getFieldValue

Same name and namespace in other branches
  1. main core/tests/Drupal/KernelTests/Core/Entity/EntityFieldValueTraitTest.php \Drupal\KernelTests\Core\Entity\EntityFieldValueTraitTest::getFieldValue()

Calls protected getFieldValue() method via reflection.

8 calls to EntityFieldValueTraitTest::getFieldValue()
EntityFieldValueTraitTest::testGetFieldValueConsistencyWithTraditionalAccess in core/tests/Drupal/KernelTests/Core/Entity/EntityFieldValueTraitTest.php
Tests getFieldValue() consistency with traditional access.
EntityFieldValueTraitTest::testGetFieldValueCorrectness in core/tests/Drupal/KernelTests/Core/Entity/EntityFieldValueTraitTest.php
Tests getFieldValue() returns correct values.
EntityFieldValueTraitTest::testGetFieldValueFallsBackToInitializedFieldObjects in core/tests/Drupal/KernelTests/Core/Entity/EntityFieldValueTraitTest.php
Tests getFieldValue() falls back to initialized field objects.
EntityFieldValueTraitTest::testGetFieldValueWithDelta in core/tests/Drupal/KernelTests/Core/Entity/EntityFieldValueTraitTest.php
Tests getFieldValue() with delta parameter.
EntityFieldValueTraitTest::testGetFieldValueWithNonExistentField in core/tests/Drupal/KernelTests/Core/Entity/EntityFieldValueTraitTest.php
Tests getFieldValue() with non-existent field.

... See full list

File

core/tests/Drupal/KernelTests/Core/Entity/EntityFieldValueTraitTest.php, line 35

Class

EntityFieldValueTraitTest
Tests the EntityFieldValueTrait.

Namespace

Drupal\KernelTests\Core\Entity

Code

private function getFieldValue(User $account, string $field_name, string $property, int $delta = 0) : mixed {
  $reflection = new \ReflectionClass($account);
  return $reflection->getMethod('getFieldValue')
    ->invoke($account, $field_name, $property, $delta);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.