1 entityreference.handlers.test | protected EntityReferenceHandlersTestCase::assertReferenceable($field, $tests, $handler_name) |
File
- core/
modules/ entityreference/ tests/ entityreference.handlers.test, line 24 - Contains EntityReferenceHandlersTestCase
Class
- EntityReferenceHandlersTestCase
- Test for Entity Reference handlers.
Code
protected function assertReferenceable($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'], 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)));
}
}
}