{
$client = $this->getClient();
- $client->request('GET', '/users/');
+ $client->request('GET', '/users/index');
$this->assertEquals(302, $client->getResponse()->getStatusCode());
$this->assertContains('login', $client->getResponse()->headers->get('location'));
$client = $this->getClient();
// Create a new user in the database
- $crawler = $client->request('GET', '/users/');
+ $crawler = $client->request('GET', '/users/index');
$this->assertEquals(200, $client->getResponse()->getStatusCode(), 'Unexpected HTTP status code for GET /users/');
$crawler = $client->click($crawler->selectLink('user.list.create_new_one')->link());
$client->submit($form);
$client->followRedirect();
- $crawler = $client->request('GET', '/users/');
+ $crawler = $client->request('GET', '/users/index');
// Check data in the show view
$this->assertGreaterThan(0, $crawler->filter('td:contains("test_user")')->count(), 'Missing element td:contains("test_user")');
// Check the element contains an attribute with value equals "Foo User"
$this->assertGreaterThan(0, $crawler->filter('[value="Foo User"]')->count(), 'Missing element [value="Foo User"]');
- $crawler = $client->request('GET', '/users/');
+ $crawler = $client->request('GET', '/users/index');
$crawler = $client->click($crawler->selectLink('user.list.edit_action')->last()->link());
// Delete the user
$this->assertEquals('disabled', $disabled[0]);
}
+
+ public function testUserSearch()
+ {
+ $this->logInAs('admin');
+ $client = $this->getClient();
+
+ // Search on unread list
+ $crawler = $client->request('GET', '/users/index');
+
+ $form = $crawler->filter('form[name=search_users]')->form();
+ $data = [
+ 'search_user[term]' => 'admin',
+ ];
+
+ $crawler = $client->submit($form, $data);
+
+ $this->assertCount(2, $crawler->filter('tr')); // 1 result + table header
+ }
}