aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/Wallabag/GroupBundle
diff options
context:
space:
mode:
authorNicolas LÅ“uillet <nicolas@loeuillet.org>2016-11-03 12:11:48 +0100
committerThomas Citharel <tcit@tcit.fr>2017-06-23 09:22:54 +0200
commit36f30fa31e0d2373f5c39851ea9138493fbde341 (patch)
treef6bba0092e72e21a3f10579250f9b2ec1e41ed70 /tests/Wallabag/GroupBundle
parente7d2d1bd8ff956c324641070801e1460c06ffaa1 (diff)
downloadwallabag-36f30fa31e0d2373f5c39851ea9138493fbde341.tar.gz
wallabag-36f30fa31e0d2373f5c39851ea9138493fbde341.tar.zst
wallabag-36f30fa31e0d2373f5c39851ea9138493fbde341.zip
Added groups management
Diffstat (limited to 'tests/Wallabag/GroupBundle')
-rw-r--r--tests/Wallabag/GroupBundle/Controller/ManageControllerTest.php64
1 files changed, 64 insertions, 0 deletions
diff --git a/tests/Wallabag/GroupBundle/Controller/ManageControllerTest.php b/tests/Wallabag/GroupBundle/Controller/ManageControllerTest.php
new file mode 100644
index 00000000..fc1852ef
--- /dev/null
+++ b/tests/Wallabag/GroupBundle/Controller/ManageControllerTest.php
@@ -0,0 +1,64 @@
1<?php
2
3namespace Wallabag\GroupBundle\Tests\Controller;
4
5use Tests\Wallabag\CoreBundle\WallabagCoreTestCase;
6
7class ManageControllerTest extends WallabagCoreTestCase
8{
9 public function testLogin()
10 {
11 $client = $this->getClient();
12
13 $client->request('GET', '/groups/');
14
15 $this->assertEquals(302, $client->getResponse()->getStatusCode());
16 $this->assertContains('login', $client->getResponse()->headers->get('location'));
17 }
18
19 public function testCompleteScenario()
20 {
21 $this->logInAs('admin');
22 $client = $this->getClient();
23
24 // Create a new group in the database
25 $crawler = $client->request('GET', '/groups/');
26 $this->assertEquals(200, $client->getResponse()->getStatusCode(), 'Unexpected HTTP status code for GET /groups/');
27 $crawler = $client->click($crawler->selectLink('group.list.create_new_one')->link());
28
29 // Fill in the form and submit it
30 $form = $crawler->selectButton('group.form.save')->form(array(
31 'new_group[name]' => 'test_group',
32 ));
33
34 $client->submit($form);
35 $client->followRedirect();
36 $crawler = $client->request('GET', '/groups/');
37
38 // Check data in the show view
39 $this->assertGreaterThan(0, $crawler->filter('td:contains("test_group")')->count(), 'Missing element td:contains("test_group")');
40
41 // Edit the group
42 $crawler = $client->click($crawler->selectLink('group.list.edit_action')->last()->link());
43
44 $form = $crawler->selectButton('group.form.save')->form(array(
45 'group[name]' => 'test_group',
46 ));
47
48 $client->submit($form);
49 $crawler = $client->followRedirect();
50
51 // Check the element contains an attribute with value equals "test_group"
52 $this->assertGreaterThan(0, $crawler->filter('[value="test_group"]')->count(), 'Missing element [value="test_group"]');
53
54 $crawler = $client->request('GET', '/groups/');
55 $crawler = $client->click($crawler->selectLink('group.list.edit_action')->last()->link());
56
57 // Delete the group
58 $client->submit($crawler->selectButton('group.form.delete')->form());
59 $crawler = $client->followRedirect();
60
61 // Check the user has been delete on the list
62 $this->assertNotRegExp('/test_group/', $client->getResponse()->getContent());
63 }
64}