public function EntityAutocompleteWebTestCase::testLabelAndID in Entity Autocomplete 7
Tests label creation and ID extraction.
File
- tests/
entity_autocomplete.test, line 152 - Tests suite for Entity Autocomplete module.
Class
- EntityAutocompleteWebTestCase
- Performs functional tests on advanced functionalities, such as administrative UI, etc.
Code
public function testLabelAndID() {
$node = $this
->drupalCreateNode(array(
'type' => 'article',
'title' => $this
->randomName(140),
'uid' => $this->author->uid,
));
$label = entity_autocomplete_get_label($node->title, $node->nid);
$this
->assertTrue(strlen($label) <= 128, 'The label length is smaller than 128 characters.');
$this
->assertEqual(entity_autocomplete_get_id($label), $node->nid, 'Extracted ID from autocomplete label is correct.');
}