aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag
diff options
context:
space:
mode:
Diffstat (limited to 'src/Wallabag')
-rw-r--r--src/Wallabag/CoreBundle/Controller/EntryController.php4
-rw-r--r--src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php31
2 files changed, 30 insertions, 5 deletions
diff --git a/src/Wallabag/CoreBundle/Controller/EntryController.php b/src/Wallabag/CoreBundle/Controller/EntryController.php
index 9dd904f1..3e1b512f 100644
--- a/src/Wallabag/CoreBundle/Controller/EntryController.php
+++ b/src/Wallabag/CoreBundle/Controller/EntryController.php
@@ -54,10 +54,10 @@ class EntryController extends Controller
54 if (false !== $existingEntry) { 54 if (false !== $existingEntry) {
55 $this->get('session')->getFlashBag()->add( 55 $this->get('session')->getFlashBag()->add(
56 'notice', 56 'notice',
57 'Entry already saved on '.$existingEntry['createdAt']->format('d-m-Y') 57 'Entry already saved on '.$existingEntry->getCreatedAt()->format('d-m-Y')
58 ); 58 );
59 59
60 return $this->redirect($this->generateUrl('view', array('id' => $existingEntry['id']))); 60 return $this->redirect($this->generateUrl('view', array('id' => $existingEntry->getId())));
61 } 61 }
62 62
63 $this->updateEntry($entry); 63 $this->updateEntry($entry);
diff --git a/src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php b/src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php
index 1d1620dc..32d6a575 100644
--- a/src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php
+++ b/src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php
@@ -127,10 +127,35 @@ class EntryControllerTest extends WallabagCoreTestCase
127 127
128 $this->assertEquals(302, $client->getResponse()->getStatusCode()); 128 $this->assertEquals(302, $client->getResponse()->getStatusCode());
129 129
130 $crawler = $client->followRedirect(); 130 $content = $client->getContainer()
131 ->get('doctrine.orm.entity_manager')
132 ->getRepository('WallabagCoreBundle:Entry')
133 ->findByUrlAndUserId($this->url, $this->getLoggedInUserId());
134
135 $this->assertInstanceOf('Wallabag\CoreBundle\Entity\Entry', $content);
136 $this->assertEquals($this->url, $content->getUrl());
137 $this->assertContains('Google', $content->getTitle());
138 }
139
140 public function testPostNewOkUrlExist()
141 {
142 $this->logInAs('admin');
143 $client = $this->getClient();
144
145 $crawler = $client->request('GET', '/new');
146
147 $this->assertEquals(200, $client->getResponse()->getStatusCode());
148
149 $form = $crawler->filter('button[type=submit]')->form();
150
151 $data = array(
152 'entry[url]' => $this->url,
153 );
131 154
132 $this->assertGreaterThan(1, $alert = $crawler->filter('h2 a')->extract(array('_text'))); 155 $client->submit($form, $data);
133 $this->assertContains('Google', $alert[0]); 156
157 $this->assertEquals(302, $client->getResponse()->getStatusCode());
158 $this->assertContains('/view/', $client->getResponse()->getTargetUrl());
134 } 159 }
135 160
136 /** 161 /**