function TMGMTEntitySourceListTestCase::testEntitySourceListSearch in Translation Management Tool 7
File
- sources/entity/ui/tmgmt_entity_ui.list.test, line 219
Class
- TMGMTEntitySourceListTestCase
Code
function testEntitySourceListSearch() {
$title_part_1 = $this
->randomName('4');
$title_part_2 = $this
->randomName('4');
$title_part_3 = $this
->randomName('4');
$this->nodes['article']['en'][0]->title = "{$title_part_1} {$title_part_2} {$title_part_3}";
node_save($this->nodes['article']['en'][0]);
$edit = array();
$edit['search[title]'] = "{$title_part_1} {$title_part_3}";
$this
->drupalPost('admin/tmgmt/sources/entity_node', $edit, t('Search'));
$this
->assertText("{$title_part_1} {$title_part_2} {$title_part_3}", 'Searching on partial node title must return the result.');
$search_result_rows = $this
->xpath('//table[@id="tmgmt-entities-list"]/tbody/tr');
$this
->assert(count($search_result_rows) == 1, 'The search result must return only one row.');
$comment = new stdClass();
$comment->comment_body[LANGUAGE_NONE][0]['value'] = $this
->randomName();
$comment->subject = $this
->randomName();
$comment->nid = $this->nodes['article']['en'][0]->nid;
$comment->is_anonymous = TRUE;
$comment->cid = 0;
$comment->pid = 0;
$comment->uid = 0;
$comment = comment_submit($comment);
comment_save($comment);
$edit = array();
$edit['search[subject]'] = $comment->subject;
$this
->drupalPost('admin/tmgmt/sources/entity_comment', $edit, t('Search'));
$this
->assertText($comment->subject, 'Searching for a comment subject.');
}