aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/Wallabag
diff options
context:
space:
mode:
authorJérémy Benoist <j0k3r@users.noreply.github.com>2017-07-25 16:54:43 +0200
committerGitHub <noreply@github.com>2017-07-25 16:54:43 +0200
commit839edf32cc08f525ef51e5a49a1764bcdfc2c461 (patch)
treeebc4185fa25ceb3a0e7294bc5e5820d87ce14563 /tests/Wallabag
parent35c1f1376c995c6cb5292a0f03c48641e50bd185 (diff)
parentff9f89fd2318cfb29a18d941077b5afc859bf0fe (diff)
downloadwallabag-839edf32cc08f525ef51e5a49a1764bcdfc2c461.tar.gz
wallabag-839edf32cc08f525ef51e5a49a1764bcdfc2c461.tar.zst
wallabag-839edf32cc08f525ef51e5a49a1764bcdfc2c461.zip
Merge pull request #3280 from Simounet/fix/2.3-date
Fix updatePublishedAt on already parsed article's date
Diffstat (limited to 'tests/Wallabag')
-rw-r--r--tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php34
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php b/tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php
index c76be13d..2dc08be2 100644
--- a/tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php
+++ b/tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php
@@ -421,6 +421,16 @@ class EntryRestControllerTest extends WallabagApiTestCase
421 421
422 public function testPostSameEntry() 422 public function testPostSameEntry()
423 { 423 {
424 $em = $this->client->getContainer()->get('doctrine.orm.entity_manager');
425 $entry = new Entry($em->getReference(User::class, 1));
426 $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');
427 $entry->setArchived(true);
428 $entry->addTag((new Tag())->setLabel('google'));
429 $entry->addTag((new Tag())->setLabel('apple'));
430 $em->persist($entry);
431 $em->flush();
432 $em->clear();
433
424 $this->client->request('POST', '/api/entries.json', [ 434 $this->client->request('POST', '/api/entries.json', [
425 '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', 435 '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',
426 'archive' => '1', 436 'archive' => '1',
@@ -1046,4 +1056,28 @@ class EntryRestControllerTest extends WallabagApiTestCase
1046 $this->assertSame(400, $this->client->getResponse()->getStatusCode()); 1056 $this->assertSame(400, $this->client->getResponse()->getStatusCode());
1047 $this->assertContains('API limit reached', $this->client->getResponse()->getContent()); 1057 $this->assertContains('API limit reached', $this->client->getResponse()->getContent());
1048 } 1058 }
1059
1060 public function testRePostEntryAndReUsePublishedAt()
1061 {
1062 $em = $this->client->getContainer()->get('doctrine.orm.entity_manager');
1063 $entry = new Entry($em->getReference(User::class, 1));
1064 $entry->setTitle('Antoine de Caunes : « Je veux avoir le droit de tâtonner »');
1065 $entry->setContent('hihi');
1066 $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');
1067 $entry->setPublishedAt(new \DateTime('2017-06-26T07:46:02+0200'));
1068 $em->persist($entry);
1069 $em->flush();
1070 $em->clear();
1071
1072 $this->client->request('POST', '/api/entries.json', [
1073 'url' => 'http://www.lemonde.fr/m-perso/article/2017/06/25/antoine-de-caunes-je-veux-avoir-le-droit-de-tatonner_5150728_4497916.html',
1074 ]);
1075
1076 $this->assertSame(200, $this->client->getResponse()->getStatusCode());
1077
1078 $content = json_decode($this->client->getResponse()->getContent(), true);
1079
1080 $this->assertGreaterThan(0, $content['id']);
1081 $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']);
1082 }
1049} 1083}