New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ticket/11492] Fix error on teampage when there are no users. #1336
Changes from all commits
60713c8
59ad90b
e5503e2
f920c69
7f527e8
4d4cf25
1296417
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,4 +40,39 @@ public function test_viewprofile() | |
$this->assert_response_success(); | ||
$this->assertContains('admin', $crawler->filter('h2')->text()); | ||
} | ||
|
||
public function test_leaders() | ||
{ | ||
$this->login(); | ||
$this->create_user('memberlist-test-moderator'); | ||
|
||
// Admin should be listed, user not | ||
$crawler = $this->request('GET', 'memberlist.php?mode=leaders&sid=' . $this->sid); | ||
$this->assert_response_success(); | ||
$this->assertContains('admin', $crawler->text()); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's probably not good enough. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Will always match There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You really should always focus what you are actually testing instead of using the whole page. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There are examples in other tests how to do this using $crawler. |
||
$this->assertNotContains('memberlist-test-user', $crawler->text()); | ||
$this->assertNotContains('memberlist-test-moderator', $crawler->text()); | ||
} | ||
|
||
public function test_leaders_remove_users() | ||
{ | ||
$this->login(); | ||
|
||
// Remove admin from admins | ||
$this->remove_user_group('ADMINISTRATORS', array('admin')); | ||
$crawler = $this->request('GET', 'memberlist.php?mode=leaders&sid=' . $this->sid); | ||
$this->assert_response_success(); | ||
$this->assertContains('admin', $crawler->text()); | ||
} | ||
|
||
public function test_leaders_add_users() | ||
{ | ||
$this->login(); | ||
|
||
// Add mod to moderators | ||
$this->add_user_group('GLOBAL_MODERATORS', array('memberlist-test-moderator')); | ||
$crawler = $this->request('GET', 'memberlist.php?mode=leaders&sid=' . $this->sid); | ||
$this->assert_response_success(); | ||
$this->assertContains('memberlist-test-moderator', $crawler->text()); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this used later on?
!empty($user_ids)
has the same result before and after this line.