X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=web%2Fcore%2Fmodules%2Fviews%2Ftests%2Fmodules%2Fviews_entity_test%2Fviews_entity_test.module;fp=web%2Fcore%2Fmodules%2Fviews%2Ftests%2Fmodules%2Fviews_entity_test%2Fviews_entity_test.module;h=7d80e84c78574214711c1e19825cf7f6a0eb95f6;hp=cd136538f242c77ef0de4bcc3715cd93558e08d4;hb=9917807b03b64faf00f6a1f29dcb6eafc454efa5;hpb=aea91e65e895364e460983b890e295aa5d5540a5 diff --git a/web/core/modules/views/tests/modules/views_entity_test/views_entity_test.module b/web/core/modules/views/tests/modules/views_entity_test/views_entity_test.module index cd136538f..7d80e84c7 100644 --- a/web/core/modules/views/tests/modules/views_entity_test/views_entity_test.module +++ b/web/core/modules/views/tests/modules/views_entity_test/views_entity_test.module @@ -12,7 +12,6 @@ use Drupal\Core\Field\FieldDefinitionInterface; use Drupal\Core\Field\FieldItemListInterface; use Drupal\Core\Session\AccountInterface; - /** * Implements hook_entity_bundle_field_info(). */ @@ -46,3 +45,20 @@ function views_entity_test_entity_field_access($operation, FieldDefinitionInterf // No opinion. return AccessResult::neutral(); } + +/** + * Implements hook_entity_load(). + * + * @see \Drupal\Tests\views\Kernel\Handler\FieldFieldTest::testSimpleExecute() + */ +function views_entity_test_entity_load(array $entities, $entity_type_id) { + if ($entity_type_id === 'entity_test') { + // Cast the value of an entity field to be something else than a string so + // we can check that + // \Drupal\views\Tests\ViewResultAssertionTrait::assertIdenticalResultsetHelper() + // takes care of converting all field values to strings. + foreach ($entities as $entity) { + $entity->user_id->target_id = (int) $entity->user_id->target_id; + } + } +}