diff options
Diffstat (limited to 'tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php')
-rw-r--r-- | tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php | 88 |
1 files changed, 43 insertions, 45 deletions
diff --git a/tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php b/tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php index 46b5f460..2151f587 100644 --- a/tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php +++ b/tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php | |||
@@ -15,7 +15,7 @@ class EntryRestControllerTest extends WallabagApiTestCase | |||
15 | $entry = $this->client->getContainer() | 15 | $entry = $this->client->getContainer() |
16 | ->get('doctrine.orm.entity_manager') | 16 | ->get('doctrine.orm.entity_manager') |
17 | ->getRepository('WallabagCoreBundle:Entry') | 17 | ->getRepository('WallabagCoreBundle:Entry') |
18 | ->findOneBy(['user' => 1, 'isArchived' => false]); | 18 | ->findOneBy(['user' => $this->getUserId(), 'isArchived' => false]); |
19 | 19 | ||
20 | if (!$entry) { | 20 | if (!$entry) { |
21 | $this->markTestSkipped('No content found in db.'); | 21 | $this->markTestSkipped('No content found in db.'); |
@@ -41,7 +41,7 @@ class EntryRestControllerTest extends WallabagApiTestCase | |||
41 | $entry = $this->client->getContainer() | 41 | $entry = $this->client->getContainer() |
42 | ->get('doctrine.orm.entity_manager') | 42 | ->get('doctrine.orm.entity_manager') |
43 | ->getRepository('WallabagCoreBundle:Entry') | 43 | ->getRepository('WallabagCoreBundle:Entry') |
44 | ->findOneBy(['user' => 1, 'url' => 'http://0.0.0.0/entry2']); | 44 | ->findOneBy(['user' => $this->getUserId(), 'url' => 'http://0.0.0.0/entry2']); |
45 | 45 | ||
46 | if (!$entry) { | 46 | if (!$entry) { |
47 | $this->markTestSkipped('No content found in db.'); | 47 | $this->markTestSkipped('No content found in db.'); |
@@ -60,7 +60,7 @@ class EntryRestControllerTest extends WallabagApiTestCase | |||
60 | $entry = $this->client->getContainer() | 60 | $entry = $this->client->getContainer() |
61 | ->get('doctrine.orm.entity_manager') | 61 | ->get('doctrine.orm.entity_manager') |
62 | ->getRepository('WallabagCoreBundle:Entry') | 62 | ->getRepository('WallabagCoreBundle:Entry') |
63 | ->findOneBy(['user' => 1, 'isArchived' => false]); | 63 | ->findOneBy(['user' => $this->getUserId(), 'isArchived' => false]); |
64 | 64 | ||
65 | if (!$entry) { | 65 | if (!$entry) { |
66 | $this->markTestSkipped('No content found in db.'); | 66 | $this->markTestSkipped('No content found in db.'); |
@@ -108,7 +108,7 @@ class EntryRestControllerTest extends WallabagApiTestCase | |||
108 | $entry = $this->client->getContainer() | 108 | $entry = $this->client->getContainer() |
109 | ->get('doctrine.orm.entity_manager') | 109 | ->get('doctrine.orm.entity_manager') |
110 | ->getRepository('WallabagCoreBundle:Entry') | 110 | ->getRepository('WallabagCoreBundle:Entry') |
111 | ->findOneBy(['user' => 2, 'isArchived' => false]); | 111 | ->findOneBy(['user' => $this->getUserId('bob'), 'isArchived' => false]); |
112 | 112 | ||
113 | if (!$entry) { | 113 | if (!$entry) { |
114 | $this->markTestSkipped('No content found in db.'); | 114 | $this->markTestSkipped('No content found in db.'); |
@@ -185,7 +185,7 @@ class EntryRestControllerTest extends WallabagApiTestCase | |||
185 | $entry = $this->client->getContainer() | 185 | $entry = $this->client->getContainer() |
186 | ->get('doctrine.orm.entity_manager') | 186 | ->get('doctrine.orm.entity_manager') |
187 | ->getRepository('WallabagCoreBundle:Entry') | 187 | ->getRepository('WallabagCoreBundle:Entry') |
188 | ->findOneByUser(1); | 188 | ->findOneByUser($this->getUserId()); |
189 | 189 | ||
190 | if (!$entry) { | 190 | if (!$entry) { |
191 | $this->markTestSkipped('No content found in db.'); | 191 | $this->markTestSkipped('No content found in db.'); |
@@ -489,8 +489,9 @@ class EntryRestControllerTest extends WallabagApiTestCase | |||
489 | $this->assertSame(0, $content['is_archived']); | 489 | $this->assertSame(0, $content['is_archived']); |
490 | $this->assertSame(0, $content['is_starred']); | 490 | $this->assertSame(0, $content['is_starred']); |
491 | $this->assertNull($content['starred_at']); | 491 | $this->assertNull($content['starred_at']); |
492 | $this->assertNull($content['archived_at']); | ||
492 | $this->assertSame('New title for my article', $content['title']); | 493 | $this->assertSame('New title for my article', $content['title']); |
493 | $this->assertSame(1, $content['user_id']); | 494 | $this->assertSame($this->getUserId(), $content['user_id']); |
494 | $this->assertCount(2, $content['tags']); | 495 | $this->assertCount(2, $content['tags']); |
495 | $this->assertNull($content['origin_url']); | 496 | $this->assertNull($content['origin_url']); |
496 | $this->assertSame('my content', $content['content']); | 497 | $this->assertSame('my content', $content['content']); |
@@ -505,7 +506,7 @@ class EntryRestControllerTest extends WallabagApiTestCase | |||
505 | public function testPostSameEntry() | 506 | public function testPostSameEntry() |
506 | { | 507 | { |
507 | $em = $this->client->getContainer()->get('doctrine.orm.entity_manager'); | 508 | $em = $this->client->getContainer()->get('doctrine.orm.entity_manager'); |
508 | $entry = new Entry($em->getReference(User::class, 1)); | 509 | $entry = new Entry($em->getReference(User::class, $this->getUserId())); |
509 | $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'); | 510 | $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'); |
510 | $entry->setArchived(true); | 511 | $entry->setArchived(true); |
511 | $entry->addTag((new Tag())->setLabel('google')); | 512 | $entry->addTag((new Tag())->setLabel('google')); |
@@ -584,7 +585,8 @@ class EntryRestControllerTest extends WallabagApiTestCase | |||
584 | $this->assertSame(1, $content['is_archived']); | 585 | $this->assertSame(1, $content['is_archived']); |
585 | $this->assertSame(1, $content['is_starred']); | 586 | $this->assertSame(1, $content['is_starred']); |
586 | $this->assertGreaterThanOrEqual($now->getTimestamp(), (new \DateTime($content['starred_at']))->getTimestamp()); | 587 | $this->assertGreaterThanOrEqual($now->getTimestamp(), (new \DateTime($content['starred_at']))->getTimestamp()); |
587 | $this->assertSame(1, $content['user_id']); | 588 | $this->assertGreaterThanOrEqual($now->getTimestamp(), (new \DateTime($content['archived_at']))->getTimestamp()); |
589 | $this->assertSame($this->getUserId(), $content['user_id']); | ||
588 | } | 590 | } |
589 | 591 | ||
590 | public function testPostArchivedAndStarredEntryWithoutQuotes() | 592 | public function testPostArchivedAndStarredEntryWithoutQuotes() |
@@ -633,7 +635,7 @@ class EntryRestControllerTest extends WallabagApiTestCase | |||
633 | $entry = $this->client->getContainer() | 635 | $entry = $this->client->getContainer() |
634 | ->get('doctrine.orm.entity_manager') | 636 | ->get('doctrine.orm.entity_manager') |
635 | ->getRepository('WallabagCoreBundle:Entry') | 637 | ->getRepository('WallabagCoreBundle:Entry') |
636 | ->findOneByUser(1); | 638 | ->findOneByUser($this->getUserId()); |
637 | 639 | ||
638 | if (!$entry) { | 640 | if (!$entry) { |
639 | $this->markTestSkipped('No content found in db.'); | 641 | $this->markTestSkipped('No content found in db.'); |
@@ -660,7 +662,7 @@ class EntryRestControllerTest extends WallabagApiTestCase | |||
660 | $this->assertSame($entry->getUrl(), $content['url']); | 662 | $this->assertSame($entry->getUrl(), $content['url']); |
661 | $this->assertSame('New awesome title', $content['title']); | 663 | $this->assertSame('New awesome title', $content['title']); |
662 | $this->assertGreaterThanOrEqual(1, \count($content['tags']), 'We force only one tag'); | 664 | $this->assertGreaterThanOrEqual(1, \count($content['tags']), 'We force only one tag'); |
663 | $this->assertSame(1, $content['user_id']); | 665 | $this->assertSame($this->getUserId(), $content['user_id']); |
664 | $this->assertSame('de_AT', $content['language']); | 666 | $this->assertSame('de_AT', $content['language']); |
665 | $this->assertSame('http://preview.io/picture.jpg', $content['preview_picture']); | 667 | $this->assertSame('http://preview.io/picture.jpg', $content['preview_picture']); |
666 | $this->assertContains('sponge', $content['published_by']); | 668 | $this->assertContains('sponge', $content['published_by']); |
@@ -675,7 +677,7 @@ class EntryRestControllerTest extends WallabagApiTestCase | |||
675 | $entry = $this->client->getContainer() | 677 | $entry = $this->client->getContainer() |
676 | ->get('doctrine.orm.entity_manager') | 678 | ->get('doctrine.orm.entity_manager') |
677 | ->getRepository('WallabagCoreBundle:Entry') | 679 | ->getRepository('WallabagCoreBundle:Entry') |
678 | ->findOneByUser(1); | 680 | ->findOneByUser($this->getUserId()); |
679 | 681 | ||
680 | if (!$entry) { | 682 | if (!$entry) { |
681 | $this->markTestSkipped('No content found in db.'); | 683 | $this->markTestSkipped('No content found in db.'); |
@@ -709,7 +711,7 @@ class EntryRestControllerTest extends WallabagApiTestCase | |||
709 | $entry = $this->client->getContainer() | 711 | $entry = $this->client->getContainer() |
710 | ->get('doctrine.orm.entity_manager') | 712 | ->get('doctrine.orm.entity_manager') |
711 | ->getRepository('WallabagCoreBundle:Entry') | 713 | ->getRepository('WallabagCoreBundle:Entry') |
712 | ->findOneByUser(1); | 714 | ->findOneByUser($this->getUserId()); |
713 | 715 | ||
714 | if (!$entry) { | 716 | if (!$entry) { |
715 | $this->markTestSkipped('No content found in db.'); | 717 | $this->markTestSkipped('No content found in db.'); |
@@ -740,7 +742,7 @@ class EntryRestControllerTest extends WallabagApiTestCase | |||
740 | $entry = $this->client->getContainer() | 742 | $entry = $this->client->getContainer() |
741 | ->get('doctrine.orm.entity_manager') | 743 | ->get('doctrine.orm.entity_manager') |
742 | ->getRepository('WallabagCoreBundle:Entry') | 744 | ->getRepository('WallabagCoreBundle:Entry') |
743 | ->findOneByUser(1); | 745 | ->findOneByUser($this->getUserId()); |
744 | 746 | ||
745 | if (!$entry) { | 747 | if (!$entry) { |
746 | $this->markTestSkipped('No content found in db.'); | 748 | $this->markTestSkipped('No content found in db.'); |
@@ -772,7 +774,7 @@ class EntryRestControllerTest extends WallabagApiTestCase | |||
772 | $entry = $this->client->getContainer() | 774 | $entry = $this->client->getContainer() |
773 | ->get('doctrine.orm.entity_manager') | 775 | ->get('doctrine.orm.entity_manager') |
774 | ->getRepository('WallabagCoreBundle:Entry') | 776 | ->getRepository('WallabagCoreBundle:Entry') |
775 | ->findOneByUser(1); | 777 | ->findOneByUser($this->getUserId()); |
776 | 778 | ||
777 | if (!$entry) { | 779 | if (!$entry) { |
778 | $this->markTestSkipped('No content found in db.'); | 780 | $this->markTestSkipped('No content found in db.'); |
@@ -817,7 +819,7 @@ class EntryRestControllerTest extends WallabagApiTestCase | |||
817 | $entry = $this->client->getContainer() | 819 | $entry = $this->client->getContainer() |
818 | ->get('doctrine.orm.entity_manager') | 820 | ->get('doctrine.orm.entity_manager') |
819 | ->getRepository('WallabagCoreBundle:Entry') | 821 | ->getRepository('WallabagCoreBundle:Entry') |
820 | ->findOneByUser(1); | 822 | ->findOneByUser($this->getUserId()); |
821 | 823 | ||
822 | if (!$entry) { | 824 | if (!$entry) { |
823 | $this->markTestSkipped('No content found in db.'); | 825 | $this->markTestSkipped('No content found in db.'); |
@@ -834,7 +836,7 @@ class EntryRestControllerTest extends WallabagApiTestCase | |||
834 | $content = json_decode($this->client->getResponse()->getContent(), true); | 836 | $content = json_decode($this->client->getResponse()->getContent(), true); |
835 | 837 | ||
836 | $this->assertArrayHasKey('tags', $content); | 838 | $this->assertArrayHasKey('tags', $content); |
837 | $this->assertSame($nbTags + 3, \count($content['tags'])); | 839 | $this->assertCount($nbTags + 3, $content['tags']); |
838 | 840 | ||
839 | $entryDB = $this->client->getContainer() | 841 | $entryDB = $this->client->getContainer() |
840 | ->get('doctrine.orm.entity_manager') | 842 | ->get('doctrine.orm.entity_manager') |
@@ -874,7 +876,7 @@ class EntryRestControllerTest extends WallabagApiTestCase | |||
874 | $content = json_decode($this->client->getResponse()->getContent(), true); | 876 | $content = json_decode($this->client->getResponse()->getContent(), true); |
875 | 877 | ||
876 | $this->assertArrayHasKey('tags', $content); | 878 | $this->assertArrayHasKey('tags', $content); |
877 | $this->assertSame($nbTags - 1, \count($content['tags'])); | 879 | $this->assertCount($nbTags - 1, $content['tags']); |
878 | } | 880 | } |
879 | 881 | ||
880 | public function testSaveIsArchivedAfterPost() | 882 | public function testSaveIsArchivedAfterPost() |
@@ -882,7 +884,7 @@ class EntryRestControllerTest extends WallabagApiTestCase | |||
882 | $entry = $this->client->getContainer() | 884 | $entry = $this->client->getContainer() |
883 | ->get('doctrine.orm.entity_manager') | 885 | ->get('doctrine.orm.entity_manager') |
884 | ->getRepository('WallabagCoreBundle:Entry') | 886 | ->getRepository('WallabagCoreBundle:Entry') |
885 | ->findOneBy(['user' => 1, 'isArchived' => true]); | 887 | ->findOneBy(['user' => $this->getUserId(), 'isArchived' => true]); |
886 | 888 | ||
887 | if (!$entry) { | 889 | if (!$entry) { |
888 | $this->markTestSkipped('No content found in db.'); | 890 | $this->markTestSkipped('No content found in db.'); |
@@ -904,7 +906,7 @@ class EntryRestControllerTest extends WallabagApiTestCase | |||
904 | $entry = $this->client->getContainer() | 906 | $entry = $this->client->getContainer() |
905 | ->get('doctrine.orm.entity_manager') | 907 | ->get('doctrine.orm.entity_manager') |
906 | ->getRepository('WallabagCoreBundle:Entry') | 908 | ->getRepository('WallabagCoreBundle:Entry') |
907 | ->findOneBy(['user' => 1, 'isStarred' => true]); | 909 | ->findOneBy(['user' => $this->getUserId(), 'isStarred' => true]); |
908 | 910 | ||
909 | if (!$entry) { | 911 | if (!$entry) { |
910 | $this->markTestSkipped('No content found in db.'); | 912 | $this->markTestSkipped('No content found in db.'); |
@@ -926,7 +928,7 @@ class EntryRestControllerTest extends WallabagApiTestCase | |||
926 | $entry = $this->client->getContainer() | 928 | $entry = $this->client->getContainer() |
927 | ->get('doctrine.orm.entity_manager') | 929 | ->get('doctrine.orm.entity_manager') |
928 | ->getRepository('WallabagCoreBundle:Entry') | 930 | ->getRepository('WallabagCoreBundle:Entry') |
929 | ->findOneBy(['user' => 1, 'isArchived' => true]); | 931 | ->findOneBy(['user' => $this->getUserId(), 'isArchived' => true]); |
930 | 932 | ||
931 | if (!$entry) { | 933 | if (!$entry) { |
932 | $this->markTestSkipped('No content found in db.'); | 934 | $this->markTestSkipped('No content found in db.'); |
@@ -952,7 +954,7 @@ class EntryRestControllerTest extends WallabagApiTestCase | |||
952 | $entry = $this->client->getContainer() | 954 | $entry = $this->client->getContainer() |
953 | ->get('doctrine.orm.entity_manager') | 955 | ->get('doctrine.orm.entity_manager') |
954 | ->getRepository('WallabagCoreBundle:Entry') | 956 | ->getRepository('WallabagCoreBundle:Entry') |
955 | ->findOneBy(['user' => 1, 'isStarred' => true]); | 957 | ->findOneBy(['user' => $this->getUserId(), 'isStarred' => true]); |
956 | 958 | ||
957 | if (!$entry) { | 959 | if (!$entry) { |
958 | $this->markTestSkipped('No content found in db.'); | 960 | $this->markTestSkipped('No content found in db.'); |
@@ -969,32 +971,27 @@ class EntryRestControllerTest extends WallabagApiTestCase | |||
969 | $this->assertGreaterThanOrEqual($now->getTimestamp(), (new \DateTime($content['starred_at']))->getTimestamp()); | 971 | $this->assertGreaterThanOrEqual($now->getTimestamp(), (new \DateTime($content['starred_at']))->getTimestamp()); |
970 | } | 972 | } |
971 | 973 | ||
972 | public function dataForEntriesExistWithUrl() | 974 | public function testGetEntriesExistsWithReturnId() |
973 | { | 975 | { |
974 | return [ | 976 | $this->client->request('GET', '/api/entries/exists?url=http://0.0.0.0/entry2&return_id=1'); |
975 | 'with_id' => [ | 977 | |
976 | 'url' => '/api/entries/exists?url=http://0.0.0.0/entry2&return_id=1', | 978 | $this->assertSame(200, $this->client->getResponse()->getStatusCode()); |
977 | 'expectedValue' => 2, | 979 | |
978 | ], | 980 | $content = json_decode($this->client->getResponse()->getContent(), true); |
979 | 'without_id' => [ | 981 | |
980 | 'url' => '/api/entries/exists?url=http://0.0.0.0/entry2', | 982 | // it returns a database id, we don't know it, so we only check it's greater than the lowest possible value |
981 | 'expectedValue' => true, | 983 | $this->assertGreaterThan(1, $content['exists']); |
982 | ], | ||
983 | ]; | ||
984 | } | 984 | } |
985 | 985 | ||
986 | /** | 986 | public function testGetEntriesExistsWithoutReturnId() |
987 | * @dataProvider dataForEntriesExistWithUrl | ||
988 | */ | ||
989 | public function testGetEntriesExists($url, $expectedValue) | ||
990 | { | 987 | { |
991 | $this->client->request('GET', $url); | 988 | $this->client->request('GET', '/api/entries/exists?url=http://0.0.0.0/entry2'); |
992 | 989 | ||
993 | $this->assertSame(200, $this->client->getResponse()->getStatusCode()); | 990 | $this->assertSame(200, $this->client->getResponse()->getStatusCode()); |
994 | 991 | ||
995 | $content = json_decode($this->client->getResponse()->getContent(), true); | 992 | $content = json_decode($this->client->getResponse()->getContent(), true); |
996 | 993 | ||
997 | $this->assertSame($expectedValue, $content['exists']); | 994 | $this->assertTrue($content['exists']); |
998 | } | 995 | } |
999 | 996 | ||
1000 | public function testGetEntriesExistsWithManyUrls() | 997 | public function testGetEntriesExistsWithManyUrls() |
@@ -1009,7 +1006,8 @@ class EntryRestControllerTest extends WallabagApiTestCase | |||
1009 | 1006 | ||
1010 | $this->assertArrayHasKey($url1, $content); | 1007 | $this->assertArrayHasKey($url1, $content); |
1011 | $this->assertArrayHasKey($url2, $content); | 1008 | $this->assertArrayHasKey($url2, $content); |
1012 | $this->assertSame(2, $content[$url1]); | 1009 | // it returns a database id, we don't know it, so we only check it's greater than the lowest possible value |
1010 | $this->assertGreaterThan(1, $content[$url1]); | ||
1013 | $this->assertNull($content[$url2]); | 1011 | $this->assertNull($content[$url2]); |
1014 | } | 1012 | } |
1015 | 1013 | ||
@@ -1051,7 +1049,7 @@ class EntryRestControllerTest extends WallabagApiTestCase | |||
1051 | { | 1049 | { |
1052 | $entry = $this->client->getContainer()->get('doctrine.orm.entity_manager') | 1050 | $entry = $this->client->getContainer()->get('doctrine.orm.entity_manager') |
1053 | ->getRepository('WallabagCoreBundle:Entry') | 1051 | ->getRepository('WallabagCoreBundle:Entry') |
1054 | ->findByUrlAndUserId('http://0.0.0.0/entry4', 1); | 1052 | ->findByUrlAndUserId('http://0.0.0.0/entry4', $this->getUserId()); |
1055 | 1053 | ||
1056 | if (!$entry) { | 1054 | if (!$entry) { |
1057 | $this->markTestSkipped('No content found in db.'); | 1055 | $this->markTestSkipped('No content found in db.'); |
@@ -1087,7 +1085,7 @@ class EntryRestControllerTest extends WallabagApiTestCase | |||
1087 | { | 1085 | { |
1088 | $entry = $this->client->getContainer()->get('doctrine.orm.entity_manager') | 1086 | $entry = $this->client->getContainer()->get('doctrine.orm.entity_manager') |
1089 | ->getRepository('WallabagCoreBundle:Entry') | 1087 | ->getRepository('WallabagCoreBundle:Entry') |
1090 | ->findByUrlAndUserId('http://0.0.0.0/entry4', 1); | 1088 | ->findByUrlAndUserId('http://0.0.0.0/entry4', $this->getUserId()); |
1091 | 1089 | ||
1092 | $tags = $entry->getTags(); | 1090 | $tags = $entry->getTags(); |
1093 | 1091 | ||
@@ -1111,7 +1109,7 @@ class EntryRestControllerTest extends WallabagApiTestCase | |||
1111 | 1109 | ||
1112 | $entry = $this->client->getContainer()->get('doctrine.orm.entity_manager') | 1110 | $entry = $this->client->getContainer()->get('doctrine.orm.entity_manager') |
1113 | ->getRepository('WallabagCoreBundle:Entry') | 1111 | ->getRepository('WallabagCoreBundle:Entry') |
1114 | ->findByUrlAndUserId('http://0.0.0.0/entry4', 1); | 1112 | ->findByUrlAndUserId('http://0.0.0.0/entry4', $this->getUserId()); |
1115 | 1113 | ||
1116 | $tags = $entry->getTags(); | 1114 | $tags = $entry->getTags(); |
1117 | $this->assertCount(4, $tags); | 1115 | $this->assertCount(4, $tags); |
@@ -1131,7 +1129,7 @@ class EntryRestControllerTest extends WallabagApiTestCase | |||
1131 | public function testDeleteEntriesTagsListAction() | 1129 | public function testDeleteEntriesTagsListAction() |
1132 | { | 1130 | { |
1133 | $em = $this->client->getContainer()->get('doctrine.orm.entity_manager'); | 1131 | $em = $this->client->getContainer()->get('doctrine.orm.entity_manager'); |
1134 | $entry = new Entry($em->getReference(User::class, 1)); | 1132 | $entry = new Entry($em->getReference(User::class, $this->getUserId())); |
1135 | $entry->setUrl('http://0.0.0.0/test-entry'); | 1133 | $entry->setUrl('http://0.0.0.0/test-entry'); |
1136 | $entry->addTag((new Tag())->setLabel('foo-tag')); | 1134 | $entry->addTag((new Tag())->setLabel('foo-tag')); |
1137 | $entry->addTag((new Tag())->setLabel('bar-tag')); | 1135 | $entry->addTag((new Tag())->setLabel('bar-tag')); |
@@ -1199,7 +1197,7 @@ class EntryRestControllerTest extends WallabagApiTestCase | |||
1199 | public function testDeleteEntriesListAction() | 1197 | public function testDeleteEntriesListAction() |
1200 | { | 1198 | { |
1201 | $em = $this->client->getContainer()->get('doctrine.orm.entity_manager'); | 1199 | $em = $this->client->getContainer()->get('doctrine.orm.entity_manager'); |
1202 | $em->persist((new Entry($em->getReference(User::class, 1)))->setUrl('http://0.0.0.0/test-entry1')); | 1200 | $em->persist((new Entry($em->getReference(User::class, $this->getUserId())))->setUrl('http://0.0.0.0/test-entry1')); |
1203 | 1201 | ||
1204 | $em->flush(); | 1202 | $em->flush(); |
1205 | $em->clear(); | 1203 | $em->clear(); |
@@ -1257,7 +1255,7 @@ class EntryRestControllerTest extends WallabagApiTestCase | |||
1257 | public function testRePostEntryAndReUsePublishedAt() | 1255 | public function testRePostEntryAndReUsePublishedAt() |
1258 | { | 1256 | { |
1259 | $em = $this->client->getContainer()->get('doctrine.orm.entity_manager'); | 1257 | $em = $this->client->getContainer()->get('doctrine.orm.entity_manager'); |
1260 | $entry = new Entry($em->getReference(User::class, 1)); | 1258 | $entry = new Entry($em->getReference(User::class, $this->getUserId())); |
1261 | $entry->setTitle('Antoine de Caunes : « Je veux avoir le droit de tâtonner »'); | 1259 | $entry->setTitle('Antoine de Caunes : « Je veux avoir le droit de tâtonner »'); |
1262 | $entry->setContent('hihi'); | 1260 | $entry->setContent('hihi'); |
1263 | $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'); | 1261 | $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'); |