protected function assertReferencable($field, $instance, $tests, $handler_name) {
$handler = entity_reference_get_selection_handler($field, $instance);
foreach ($tests as $test) {
foreach ($test['arguments'] as $arguments) {
$result = call_user_func_array(array(
$handler,
'getReferencableEntities',
), $arguments);
$this
->assertEqual($result, $test['result'], format_string('Valid result set returned by @handler.', array(
'@handler' => $handler_name,
)));
$result = call_user_func_array(array(
$handler,
'countReferencableEntities',
), $arguments);
if (!empty($test['result'])) {
$bundle = key($test['result']);
$count = count($test['result'][$bundle]);
}
else {
$count = 0;
}
$this
->assertEqual($result, $count, format_string('Valid count returned by @handler.', array(
'@handler' => $handler_name,
)));
}
}
}