protected function ReferenceOptionLimitEntityreferenceTestCaseBase::getNodeByTitle in Reference field option limit 7
Helper for getting a node by title.
This works for retrieving both country and city nodes.
Parameters
$node_title: The title of the node to get.
Return value
A node entity.
5 calls to ReferenceOptionLimitEntityreferenceTestCaseBase::getNodeByTitle()
- ReferenceOptionLimitEntityreferenceTestCase::changeFieldSettings in tests/
reference_option_limit.test - Helper to change the field settings.
- ReferenceOptionLimitEntityreferenceTestCase::getEditArray in tests/
reference_option_limit.test - Helper to get the values for POST and AJAX operations.
- ReferenceOptionLimitEntityreferenceTestCase::helperTestNodeCreateForm in tests/
reference_option_limit.test - Helper to run tests.
- ReferenceOptionLimitEntityreferenceTestCase::rolPostAJAXCountryField in tests/
reference_option_limit.test - Wrapper around drupalPostAJAX() for updating the country field.
- ReferenceOptionLimitProfile2TestCase::testProfile2Form in tests/
reference_option_limit.test - Test the functionality of Profile2 fields on a user edit form.
File
- tests/
reference_option_limit.test, line 206 - Contains tests for the Reference option limit module.
Class
- ReferenceOptionLimitEntityreferenceTestCaseBase
- Common base class for test cases that use entityreference fields.
Code
protected function getNodeByTitle($title) {
$query = new EntityFieldQuery();
$query
->entityCondition('entity_type', 'node');
$query
->propertyCondition('title', $title);
$result = $query
->execute();
// We expect only one node to satisfy this query.
$nids = array_keys($result['node']);
$node = node_load(array_pop($nids));
$this
->assertTrue($node, format_string("Node id !nid with the given title %title was found.", array(
'!nid' => $node->nid,
'%title' => $title,
)));
return $node;
}