X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=tests%2FWallabag%2FApiBundle%2FController%2FEntryRestControllerTest.php;h=9722986eba38840068d271a45104c3a4b50d87db;hb=778543311f5efde4c99321f257c5a9c34a7dea5f;hp=65a3ccd9a95a96d7b7e9d277df2c53e27c67a130;hpb=f4f7994c40ca57c7e6f8ca0a3d298c50c4e5f813;p=github%2Fwallabag%2Fwallabag.git diff --git a/tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php b/tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php index 65a3ccd9..9722986e 100644 --- a/tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php +++ b/tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php @@ -408,6 +408,7 @@ class EntryRestControllerTest extends WallabagApiTestCase $this->assertSame($entry->getTitle(), $content['title']); $this->assertSame($entry->getUrl(), $content['url']); + $this->assertSame($entry->getId(), $content['id']); // We'll try to delete this entry again $this->client->request('DELETE', '/api/entries/' . $entry->getId() . '.json'); @@ -418,7 +419,7 @@ class EntryRestControllerTest extends WallabagApiTestCase public function testPostEntry() { $this->client->request('POST', '/api/entries.json', [ - 'url' => 'http://www.lemonde.fr/pixels/article/2015/03/28/plongee-dans-l-univers-d-ingress-le-jeu-de-google-aux-frontieres-du-reel_4601155_4408996.html', + 'url' => 'https://www.lemonde.fr/pixels/article/2015/03/28/plongee-dans-l-univers-d-ingress-le-jeu-de-google-aux-frontieres-du-reel_4601155_4408996.html', 'tags' => 'google', 'title' => 'New title for my article', 'content' => 'my content', @@ -433,7 +434,7 @@ class EntryRestControllerTest extends WallabagApiTestCase $content = json_decode($this->client->getResponse()->getContent(), true); $this->assertGreaterThan(0, $content['id']); - $this->assertSame('http://www.lemonde.fr/pixels/article/2015/03/28/plongee-dans-l-univers-d-ingress-le-jeu-de-google-aux-frontieres-du-reel_4601155_4408996.html', $content['url']); + $this->assertSame('https://www.lemonde.fr/pixels/article/2015/03/28/plongee-dans-l-univers-d-ingress-le-jeu-de-google-aux-frontieres-du-reel_4601155_4408996.html', $content['url']); $this->assertSame(0, $content['is_archived']); $this->assertSame(0, $content['is_starred']); $this->assertNull($content['starred_at']); @@ -454,7 +455,7 @@ class EntryRestControllerTest extends WallabagApiTestCase { $em = $this->client->getContainer()->get('doctrine.orm.entity_manager'); $entry = new Entry($em->getReference(User::class, 1)); - $entry->setUrl('http://www.lemonde.fr/pixels/article/2015/03/28/plongee-dans-l-univers-d-ingress-le-jeu-de-google-aux-frontieres-du-reel_4601155_4408996.html'); + $entry->setUrl('https://www.lemonde.fr/pixels/article/2015/03/28/plongee-dans-l-univers-d-ingress-le-jeu-de-google-aux-frontieres-du-reel_4601155_4408996.html'); $entry->setArchived(true); $entry->addTag((new Tag())->setLabel('google')); $entry->addTag((new Tag())->setLabel('apple')); @@ -463,7 +464,7 @@ class EntryRestControllerTest extends WallabagApiTestCase $em->clear(); $this->client->request('POST', '/api/entries.json', [ - 'url' => 'http://www.lemonde.fr/pixels/article/2015/03/28/plongee-dans-l-univers-d-ingress-le-jeu-de-google-aux-frontieres-du-reel_4601155_4408996.html', + 'url' => 'https://www.lemonde.fr/pixels/article/2015/03/28/plongee-dans-l-univers-d-ingress-le-jeu-de-google-aux-frontieres-du-reel_4601155_4408996.html', 'archive' => '1', 'tags' => 'google, apple', ]); @@ -473,7 +474,7 @@ class EntryRestControllerTest extends WallabagApiTestCase $content = json_decode($this->client->getResponse()->getContent(), true); $this->assertGreaterThan(0, $content['id']); - $this->assertSame('http://www.lemonde.fr/pixels/article/2015/03/28/plongee-dans-l-univers-d-ingress-le-jeu-de-google-aux-frontieres-du-reel_4601155_4408996.html', $content['url']); + $this->assertSame('https://www.lemonde.fr/pixels/article/2015/03/28/plongee-dans-l-univers-d-ingress-le-jeu-de-google-aux-frontieres-du-reel_4601155_4408996.html', $content['url']); $this->assertSame(1, $content['is_archived']); $this->assertSame(0, $content['is_starred']); $this->assertCount(3, $content['tags']); @@ -501,6 +502,8 @@ class EntryRestControllerTest extends WallabagApiTestCase $content = json_decode($this->client->getResponse()->getContent(), true); $this->assertGreaterThan(0, $content['id']); $this->assertSame('http://www.example.com/', $content['url']); + $this->assertSame('www.example.com', $content['domain_name']); + $this->assertSame('www.example.com', $content['title']); } finally { // Remove the created entry to avoid side effects on other tests if (isset($content['id'])) { @@ -516,7 +519,7 @@ class EntryRestControllerTest extends WallabagApiTestCase { $now = new \DateTime(); $this->client->request('POST', '/api/entries.json', [ - 'url' => 'http://www.lemonde.fr/idees/article/2016/02/08/preserver-la-liberte-d-expression-sur-les-reseaux-sociaux_4861503_3232.html', + 'url' => 'https://www.lemonde.fr/idees/article/2016/02/08/preserver-la-liberte-d-expression-sur-les-reseaux-sociaux_4861503_3232.html', 'archive' => '1', 'starred' => '1', ]); @@ -526,7 +529,7 @@ class EntryRestControllerTest extends WallabagApiTestCase $content = json_decode($this->client->getResponse()->getContent(), true); $this->assertGreaterThan(0, $content['id']); - $this->assertSame('http://www.lemonde.fr/idees/article/2016/02/08/preserver-la-liberte-d-expression-sur-les-reseaux-sociaux_4861503_3232.html', $content['url']); + $this->assertSame('https://www.lemonde.fr/idees/article/2016/02/08/preserver-la-liberte-d-expression-sur-les-reseaux-sociaux_4861503_3232.html', $content['url']); $this->assertSame(1, $content['is_archived']); $this->assertSame(1, $content['is_starred']); $this->assertGreaterThanOrEqual($now->getTimestamp(), (new \DateTime($content['starred_at']))->getTimestamp()); @@ -536,7 +539,7 @@ class EntryRestControllerTest extends WallabagApiTestCase public function testPostArchivedAndStarredEntryWithoutQuotes() { $this->client->request('POST', '/api/entries.json', [ - 'url' => 'http://www.lemonde.fr/idees/article/2016/02/08/preserver-la-liberte-d-expression-sur-les-reseaux-sociaux_4861503_3232.html', + 'url' => 'https://www.lemonde.fr/idees/article/2016/02/08/preserver-la-liberte-d-expression-sur-les-reseaux-sociaux_4861503_3232.html', 'archive' => 0, 'starred' => 1, ]); @@ -546,7 +549,7 @@ class EntryRestControllerTest extends WallabagApiTestCase $content = json_decode($this->client->getResponse()->getContent(), true); $this->assertGreaterThan(0, $content['id']); - $this->assertSame('http://www.lemonde.fr/idees/article/2016/02/08/preserver-la-liberte-d-expression-sur-les-reseaux-sociaux_4861503_3232.html', $content['url']); + $this->assertSame('https://www.lemonde.fr/idees/article/2016/02/08/preserver-la-liberte-d-expression-sur-les-reseaux-sociaux_4861503_3232.html', $content['url']); $this->assertSame(0, $content['is_archived']); $this->assertSame(1, $content['is_starred']); } @@ -554,7 +557,7 @@ class EntryRestControllerTest extends WallabagApiTestCase public function testPostEntryWithOriginUrl() { $this->client->request('POST', '/api/entries.json', [ - 'url' => 'http://www.lemonde.fr/pixels/article/2015/03/28/plongee-dans-l-univers-d-ingress-le-jeu-de-google-aux-frontieres-du-reel_4601155_4408996.html', + 'url' => 'https://www.lemonde.fr/pixels/article/2015/03/28/plongee-dans-l-univers-d-ingress-le-jeu-de-google-aux-frontieres-du-reel_4601155_4408996.html', 'tags' => 'google', 'title' => 'New title for my article', 'content' => 'my content', @@ -570,7 +573,7 @@ class EntryRestControllerTest extends WallabagApiTestCase $content = json_decode($this->client->getResponse()->getContent(), true); $this->assertGreaterThan(0, $content['id']); - $this->assertSame('http://www.lemonde.fr/pixels/article/2015/03/28/plongee-dans-l-univers-d-ingress-le-jeu-de-google-aux-frontieres-du-reel_4601155_4408996.html', $content['url']); + $this->assertSame('https://www.lemonde.fr/pixels/article/2015/03/28/plongee-dans-l-univers-d-ingress-le-jeu-de-google-aux-frontieres-du-reel_4601155_4408996.html', $content['url']); $this->assertSame('http://mysource.tld', $content['origin_url']); } @@ -983,7 +986,7 @@ class EntryRestControllerTest extends WallabagApiTestCase $content = json_decode($this->client->getResponse()->getContent(), true); - $this->assertSame(false, $content['exists']); + $this->assertFalse($content['exists']); } public function testGetEntriesExistsWithNoUrl() @@ -1010,7 +1013,7 @@ class EntryRestControllerTest extends WallabagApiTestCase public function testReloadEntry() { $this->client->request('POST', '/api/entries.json', [ - 'url' => 'http://www.lemonde.fr/pixels/article/2015/03/28/plongee-dans-l-univers-d-ingress-le-jeu-de-google-aux-frontieres-du-reel_4601155_4408996.html', + 'url' => 'https://www.lemonde.fr/pixels/article/2015/03/28/plongee-dans-l-univers-d-ingress-le-jeu-de-google-aux-frontieres-du-reel_4601155_4408996.html', 'archive' => '1', 'tags' => 'google, apple', ]); @@ -1114,7 +1117,7 @@ class EntryRestControllerTest extends WallabagApiTestCase public function testPostEntriesListAction() { $list = [ - 'http://www.lemonde.fr/musiques/article/2017/04/23/loin-de-la-politique-le-printemps-de-bourges-retombe-en-enfance_5115862_1654986.html', + 'https://www.lemonde.fr/musiques/article/2017/04/23/loin-de-la-politique-le-printemps-de-bourges-retombe-en-enfance_5115862_1654986.html', 'http://0.0.0.0/entry2', ]; @@ -1125,7 +1128,7 @@ class EntryRestControllerTest extends WallabagApiTestCase $content = json_decode($this->client->getResponse()->getContent(), true); $this->assertInternalType('int', $content[0]['entry']); - $this->assertSame('http://www.lemonde.fr/musiques/article/2017/04/23/loin-de-la-politique-le-printemps-de-bourges-retombe-en-enfance_5115862_1654986.html', $content[0]['url']); + $this->assertSame('https://www.lemonde.fr/musiques/article/2017/04/23/loin-de-la-politique-le-printemps-de-bourges-retombe-en-enfance_5115862_1654986.html', $content[0]['url']); $this->assertInternalType('int', $content[1]['entry']); $this->assertSame('http://0.0.0.0/entry2', $content[1]['url']); @@ -1206,14 +1209,14 @@ class EntryRestControllerTest extends WallabagApiTestCase $entry = new Entry($em->getReference(User::class, 1)); $entry->setTitle('Antoine de Caunes : « Je veux avoir le droit de tâtonner »'); $entry->setContent('hihi'); - $entry->setUrl('http://www.lemonde.fr/m-perso/article/2017/06/25/antoine-de-caunes-je-veux-avoir-le-droit-de-tatonner_5150728_4497916.html'); + $entry->setUrl('https://www.lemonde.fr/m-perso/article/2017/06/25/antoine-de-caunes-je-veux-avoir-le-droit-de-tatonner_5150728_4497916.html'); $entry->setPublishedAt(new \DateTime('2017-06-26T07:46:02+0200')); $em->persist($entry); $em->flush(); $em->clear(); $this->client->request('POST', '/api/entries.json', [ - 'url' => 'http://www.lemonde.fr/m-perso/article/2017/06/25/antoine-de-caunes-je-veux-avoir-le-droit-de-tatonner_5150728_4497916.html', + 'url' => 'https://www.lemonde.fr/m-perso/article/2017/06/25/antoine-de-caunes-je-veux-avoir-le-droit-de-tatonner_5150728_4497916.html', ]); $this->assertSame(200, $this->client->getResponse()->getStatusCode()); @@ -1221,6 +1224,6 @@ class EntryRestControllerTest extends WallabagApiTestCase $content = json_decode($this->client->getResponse()->getContent(), true); $this->assertGreaterThan(0, $content['id']); - $this->assertSame('http://www.lemonde.fr/m-perso/article/2017/06/25/antoine-de-caunes-je-veux-avoir-le-droit-de-tatonner_5150728_4497916.html', $content['url']); + $this->assertSame('https://www.lemonde.fr/m-perso/article/2017/06/25/antoine-de-caunes-je-veux-avoir-le-droit-de-tatonner_5150728_4497916.html', $content['url']); } }