aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/Wallabag
diff options
context:
space:
mode:
authorJeremy Benoist <jeremy.benoist@gmail.com>2017-07-03 13:56:39 +0200
committerJeremy Benoist <jeremy.benoist@gmail.com>2017-07-03 13:56:39 +0200
commitc18a2476b601bc6b9893462d9be680c2e13c89e8 (patch)
treee1e2d162251b7069236ce66bc57694695d5571bb /tests/Wallabag
parentd0ec2ddd2354e39badd947c2214f47193784b1c7 (diff)
downloadwallabag-c18a2476b601bc6b9893462d9be680c2e13c89e8.tar.gz
wallabag-c18a2476b601bc6b9893462d9be680c2e13c89e8.tar.zst
wallabag-c18a2476b601bc6b9893462d9be680c2e13c89e8.zip
CS
Diffstat (limited to 'tests/Wallabag')
-rw-r--r--tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php29
-rw-r--r--tests/Wallabag/CoreBundle/Helper/ContentProxyTest.php10
2 files changed, 19 insertions, 20 deletions
diff --git a/tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php b/tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php
index 0647bb23..c76be13d 100644
--- a/tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php
+++ b/tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php
@@ -519,7 +519,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
519 $this->markTestSkipped('No content found in db.'); 519 $this->markTestSkipped('No content found in db.');
520 } 520 }
521 521
522 $this->client->request('PATCH', '/api/entries/'.$entry->getId().'.json', [ 522 $this->client->request('PATCH', '/api/entries/' . $entry->getId() . '.json', [
523 'title' => 'New awesome title', 523 'title' => 'New awesome title',
524 'tags' => 'new tag ' . uniqid(), 524 'tags' => 'new tag ' . uniqid(),
525 'starred' => '1', 525 'starred' => '1',
@@ -579,10 +579,9 @@ class EntryRestControllerTest extends WallabagApiTestCase
579 $this->assertSame($entry->getId(), $content['id']); 579 $this->assertSame($entry->getId(), $content['id']);
580 $this->assertSame($entry->getUrl(), $content['url']); 580 $this->assertSame($entry->getUrl(), $content['url']);
581 $this->assertGreaterThanOrEqual(1, count($content['tags']), 'We force only one tag'); 581 $this->assertGreaterThanOrEqual(1, count($content['tags']), 'We force only one tag');
582 $this->assertGreaterThan($nbTags, count($content['tags']));
583 $this->assertEmpty($content['published_by'], 'Authors were not saved because of an array instead of a string'); 582 $this->assertEmpty($content['published_by'], 'Authors were not saved because of an array instead of a string');
584 $this->assertEquals($previousContent, $content['content'], 'Ensure content has not moved'); 583 $this->assertSame($previousContent, $content['content'], 'Ensure content has not moved');
585 $this->assertEquals($previousLanguage, $content['language'], 'Ensure language has not moved'); 584 $this->assertSame($previousLanguage, $content['language'], 'Ensure language has not moved');
586 } 585 }
587 586
588 public function testGetTagsEntry() 587 public function testGetTagsEntry()
@@ -730,8 +729,8 @@ class EntryRestControllerTest extends WallabagApiTestCase
730 729
731 $previousTitle = $entry->getTitle(); 730 $previousTitle = $entry->getTitle();
732 731
733 $this->client->request('PATCH', '/api/entries/'.$entry->getId().'.json', [ 732 $this->client->request('PATCH', '/api/entries/' . $entry->getId() . '.json', [
734 'title' => $entry->getTitle().'++', 733 'title' => $entry->getTitle() . '++',
735 ]); 734 ]);
736 735
737 $this->assertSame(200, $this->client->getResponse()->getStatusCode()); 736 $this->assertSame(200, $this->client->getResponse()->getStatusCode());
@@ -739,7 +738,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
739 $content = json_decode($this->client->getResponse()->getContent(), true); 738 $content = json_decode($this->client->getResponse()->getContent(), true);
740 739
741 $this->assertSame(1, $content['is_archived']); 740 $this->assertSame(1, $content['is_archived']);
742 $this->assertEquals($previousTitle.'++', $content['title']); 741 $this->assertSame($previousTitle . '++', $content['title']);
743 } 742 }
744 743
745 public function testSaveIsStarredAfterPatch() 744 public function testSaveIsStarredAfterPatch()
@@ -913,9 +912,9 @@ class EntryRestControllerTest extends WallabagApiTestCase
913 912
914 public function testPostEntriesTagsListActionNoList() 913 public function testPostEntriesTagsListActionNoList()
915 { 914 {
916 $this->client->request('POST', '/api/entries/tags/lists?list='.json_encode([])); 915 $this->client->request('POST', '/api/entries/tags/lists?list=' . json_encode([]));
917 916
918 $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); 917 $this->assertSame(200, $this->client->getResponse()->getStatusCode());
919 918
920 $content = json_decode($this->client->getResponse()->getContent(), true); 919 $content = json_decode($this->client->getResponse()->getContent(), true);
921 920
@@ -950,9 +949,9 @@ class EntryRestControllerTest extends WallabagApiTestCase
950 949
951 public function testDeleteEntriesTagsListActionNoList() 950 public function testDeleteEntriesTagsListActionNoList()
952 { 951 {
953 $this->client->request('DELETE', '/api/entries/tags/list?list='.json_encode([])); 952 $this->client->request('DELETE', '/api/entries/tags/list?list=' . json_encode([]));
954 953
955 $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); 954 $this->assertSame(200, $this->client->getResponse()->getStatusCode());
956 955
957 $content = json_decode($this->client->getResponse()->getContent(), true); 956 $content = json_decode($this->client->getResponse()->getContent(), true);
958 957
@@ -981,9 +980,9 @@ class EntryRestControllerTest extends WallabagApiTestCase
981 980
982 public function testPostEntriesListActionWithNoUrls() 981 public function testPostEntriesListActionWithNoUrls()
983 { 982 {
984 $this->client->request('POST', '/api/entries/lists?urls='.json_encode([])); 983 $this->client->request('POST', '/api/entries/lists?urls=' . json_encode([]));
985 984
986 $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); 985 $this->assertSame(200, $this->client->getResponse()->getStatusCode());
987 986
988 $content = json_decode($this->client->getResponse()->getContent(), true); 987 $content = json_decode($this->client->getResponse()->getContent(), true);
989 988
@@ -1017,9 +1016,9 @@ class EntryRestControllerTest extends WallabagApiTestCase
1017 1016
1018 public function testDeleteEntriesListActionWithNoUrls() 1017 public function testDeleteEntriesListActionWithNoUrls()
1019 { 1018 {
1020 $this->client->request('DELETE', '/api/entries/list?urls='.json_encode([])); 1019 $this->client->request('DELETE', '/api/entries/list?urls=' . json_encode([]));
1021 1020
1022 $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); 1021 $this->assertSame(200, $this->client->getResponse()->getStatusCode());
1023 1022
1024 $content = json_decode($this->client->getResponse()->getContent(), true); 1023 $content = json_decode($this->client->getResponse()->getContent(), true);
1025 1024
diff --git a/tests/Wallabag/CoreBundle/Helper/ContentProxyTest.php b/tests/Wallabag/CoreBundle/Helper/ContentProxyTest.php
index c0b68d53..f94c2137 100644
--- a/tests/Wallabag/CoreBundle/Helper/ContentProxyTest.php
+++ b/tests/Wallabag/CoreBundle/Helper/ContentProxyTest.php
@@ -521,13 +521,13 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase
521 $entry = new Entry(new User()); 521 $entry = new Entry(new User());
522 $proxy->updateEntry($entry, 'http://0.0.0.0'); 522 $proxy->updateEntry($entry, 'http://0.0.0.0');
523 523
524 $this->assertEquals('http://1.1.1.1/image.jpg', $entry->getUrl()); 524 $this->assertSame('http://1.1.1.1/image.jpg', $entry->getUrl());
525 $this->assertEquals('this is my title', $entry->getTitle()); 525 $this->assertSame('this is my title', $entry->getTitle());
526 $this->assertContains('http://1.1.1.1/image.jpg', $entry->getContent()); 526 $this->assertContains('http://1.1.1.1/image.jpg', $entry->getContent());
527 $this->assertSame('http://1.1.1.1/image.jpg', $entry->getPreviewPicture()); 527 $this->assertSame('http://1.1.1.1/image.jpg', $entry->getPreviewPicture());
528 $this->assertEquals('image/jpeg', $entry->getMimetype()); 528 $this->assertSame('image/jpeg', $entry->getMimetype());
529 $this->assertEquals('200', $entry->getHttpStatus()); 529 $this->assertSame('200', $entry->getHttpStatus());
530 $this->assertEquals('1.1.1.1', $entry->getDomainName()); 530 $this->assertSame('1.1.1.1', $entry->getDomainName());
531 } 531 }
532 532
533 private function getTaggerMock() 533 private function getTaggerMock()