You are here

protected function entityReferenceSelectionAccessTest::assertReferencable in Entity reference 8

3 calls to entityReferenceSelectionAccessTest::assertReferencable()
entityReferenceSelectionAccessTest::testCommentHandler in lib/Drupal/entityreference/Tests/entityReferenceSelectionAccessTest.php
Test the comment-specific overrides of the entity handler.
entityReferenceSelectionAccessTest::testNodeHandler in lib/Drupal/entityreference/Tests/entityReferenceSelectionAccessTest.php
Test the node-specific overrides of the entity handler.
entityReferenceSelectionAccessTest::testUserHandler in lib/Drupal/entityreference/Tests/entityReferenceSelectionAccessTest.php
Test the user-specific overrides of the entity handler.

File

lib/Drupal/entityreference/Tests/entityReferenceSelectionAccessTest.php, line 27
Contains Drupal\entityreference\Tests\entityReferenceSelectionAccessTest.

Class

entityReferenceSelectionAccessTest
Test for Entity Reference handlers.

Namespace

Drupal\entityreference\Tests

Code

protected function assertReferencable($field, $tests, $handler_name) {
  $handler = entityreference_get_selection_handler($field);
  foreach ($tests as $test) {
    foreach ($test['arguments'] as $arguments) {
      $result = call_user_func_array(array(
        $handler,
        'getReferencableEntities',
      ), $arguments);
      $this
        ->assertEqual($result, $test['result'], t('Valid result set returned by @handler.', array(
        '@handler' => $handler_name,
      )));
      $result = call_user_func_array(array(
        $handler,
        'countReferencableEntities',
      ), $arguments);
      $this
        ->assertEqual($result, count($test['result']), t('Valid count returned by @handler.', array(
        '@handler' => $handler_name,
      )));
    }
  }
}