aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php
diff options
context:
space:
mode:
authorJeremy Benoist <jeremy.benoist@gmail.com>2015-06-02 18:54:34 +0200
committerJeremy Benoist <jeremy.benoist@gmail.com>2015-06-02 18:56:07 +0200
commit82d6d9cb06a1486e2e3b05fa6ce857b3b8655180 (patch)
tree973017b934f12bed3a46cc23b30446a41c9ff7d8 /src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php
parent51d9699fa130a18a1c5cd09d1b03a382d73e91db (diff)
downloadwallabag-82d6d9cb06a1486e2e3b05fa6ce857b3b8655180.tar.gz
wallabag-82d6d9cb06a1486e2e3b05fa6ce857b3b8655180.tar.zst
wallabag-82d6d9cb06a1486e2e3b05fa6ce857b3b8655180.zip
Add basic title edition
Fix #218 I mean basic, because there is no javascript at all. It could be a nice edit-in-place. But for the moment, it is simple.
Diffstat (limited to 'src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php')
-rw-r--r--src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php48
1 files changed, 48 insertions, 0 deletions
diff --git a/src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php b/src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php
index 8a7fdda2..904e2a5c 100644
--- a/src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php
+++ b/src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php
@@ -109,6 +109,54 @@ class EntryControllerTest extends WallabagCoreTestCase
109 $this->assertContains($content->getTitle(), $client->getResponse()->getContent()); 109 $this->assertContains($content->getTitle(), $client->getResponse()->getContent());
110 } 110 }
111 111
112 public function testEdit()
113 {
114 $this->logInAs('admin');
115 $client = $this->getClient();
116
117 $content = $client->getContainer()
118 ->get('doctrine.orm.entity_manager')
119 ->getRepository('WallabagCoreBundle:Entry')
120 ->findOneByIsArchived(false);
121
122 $crawler = $client->request('GET', '/edit/'.$content->getId());
123
124 $this->assertEquals(200, $client->getResponse()->getStatusCode());
125
126 $this->assertCount(1, $crawler->filter('input[id=entry_title]'));
127 $this->assertCount(1, $crawler->filter('button[id=entry_save]'));
128 }
129
130 public function testEditUpdate()
131 {
132 $this->logInAs('admin');
133 $client = $this->getClient();
134
135 $content = $client->getContainer()
136 ->get('doctrine.orm.entity_manager')
137 ->getRepository('WallabagCoreBundle:Entry')
138 ->findOneByIsArchived(false);
139
140 $crawler = $client->request('GET', '/edit/'.$content->getId());
141
142 $this->assertEquals(200, $client->getResponse()->getStatusCode());
143
144 $form = $crawler->filter('button[type=submit]')->form();
145
146 $data = array(
147 'entry[title]' => 'My updated title hehe :)',
148 );
149
150 $client->submit($form, $data);
151
152 $this->assertEquals(302, $client->getResponse()->getStatusCode());
153
154 $crawler = $client->followRedirect();
155
156 $this->assertGreaterThan(1, $alert = $crawler->filter('div[id=article] h1')->extract(array('_text')));
157 $this->assertContains('My updated title hehe :)', $alert[0]);
158 }
159
112 public function testToggleArchive() 160 public function testToggleArchive()
113 { 161 {
114 $this->logInAs('admin'); 162 $this->logInAs('admin');