+ /**
+ * This test will require an internet connection.
+ */
+ public function testPostNewOkUrlExistWithRedirection()
+ {
+ $this->logInAs('admin');
+ $client = $this->getClient();
+
+ $url = 'https://wllbg.org/test-redirect/c51c';
+
+ $crawler = $client->request('GET', '/new');
+
+ $this->assertSame(200, $client->getResponse()->getStatusCode());
+
+ $form = $crawler->filter('form[name=entry]')->form();
+
+ $data = [
+ 'entry[url]' => $url,
+ ];
+
+ $client->submit($form, $data);
+
+ $crawler = $client->request('GET', '/new');
+
+ $this->assertSame(200, $client->getResponse()->getStatusCode());
+
+ $form = $crawler->filter('form[name=entry]')->form();
+
+ $data = [
+ 'entry[url]' => $url,
+ ];
+
+ $client->submit($form, $data);
+
+ $this->assertSame(302, $client->getResponse()->getStatusCode());
+ $this->assertContains('/view/', $client->getResponse()->getTargetUrl());
+ }
+