aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php
diff options
context:
space:
mode:
authorJeremy Benoist <jeremy.benoist@gmail.com>2016-01-21 16:37:25 +0100
committerJeremy Benoist <jeremy.benoist@gmail.com>2016-01-21 16:37:25 +0100
commita0d6ccc5ca0dc0082467cc65b006150aff2488c4 (patch)
treea5f405e032a2eb8268427ad8c6106cb7d6ffe4dd /src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php
parente56983af1f7b74993784687e7b192a898422fe7f (diff)
downloadwallabag-a0d6ccc5ca0dc0082467cc65b006150aff2488c4.tar.gz
wallabag-a0d6ccc5ca0dc0082467cc65b006150aff2488c4.tar.zst
wallabag-a0d6ccc5ca0dc0082467cc65b006150aff2488c4.zip
Fix bad type after using findByUrlAndUserId
It returns an object since few commits this part of (untested) code still use an array. Also add test for that part of code.
Diffstat (limited to 'src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php')
-rw-r--r--src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php31
1 files changed, 28 insertions, 3 deletions
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 /**