public function OpignoSimpleUIOGTest::testOGNodeUrls in Opigno 7.0
Simple UI overrides several URLs to more user-friendly, logical items. For example, an OG node will have a "Members" tab, and underneath that an "Add members" sub tab. However, the "Group" tab is removed.
File
- modules/
opigno_simple_ui/ tests/ opigno_simple_ui.og.test, line 34 - Check OG overrides.
Class
- OpignoSimpleUIOGTest
- @file Check OG overrides.
Code
public function testOGNodeUrls() {
if ($this
->_checkDependency('og') || $this
->_checkDependency('og_ui')) {
$this
->drupalLogin($this->admin);
$this
->_prepareOGType();
$gid = $this
->_createOGNode();
// There should be no "Group" tab
$this
->assertNoLink('Group', 'Should be no "Group" tab.');
$this
->clickLink('Members');
$this
->assertText($this->admin->name);
$this
->clickLink('Add members');
$this
->assertText('Add a group member to');
// Hide membership state
$this
->assertNoFieldById('edit-og-add-user-state', '', 'Hide membership state. Defaults to active.');
// Hide membership type
$this
->assertNoFieldById('edit-og-add-user-membership-type', '', 'Hide membership type. Defaults to default anyway.');
// Possibility to select role directly
$this
->assertFieldById('edit-og-role-3', '', 'Roles checkboxes exist.');
// Add user to group and grant admin rights (role #3 by default)
$edit = array(
'og_add_user' => $this->authenticated_user->name,
"og_role[3]" => 3,
);
$this
->drupalPost($this
->getURL(), $edit, 'Add users');
$this
->clickLink('Members');
$this
->assertText($this->authenticated_user->name, 'Found user name. Was added to group.');
$matches = array();
$this
->assertEqual(preg_match_all('/<li[\\s="a-zA-Z0-9]*>administrator member<\\/li>/', $this
->drupalGetContent(), $matches), 1, 'Should have administrator rights (find text 1x).');
}
}