aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/Wallabag/ApiBundle/Controller
diff options
context:
space:
mode:
Diffstat (limited to 'tests/Wallabag/ApiBundle/Controller')
-rw-r--r--tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php24
1 files changed, 12 insertions, 12 deletions
diff --git a/tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php b/tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php
index fc4dc9d9..34de8ec8 100644
--- a/tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php
+++ b/tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php
@@ -973,7 +973,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
973 973
974 public function dataForEntriesExistWithUrl() 974 public function dataForEntriesExistWithUrl()
975 { 975 {
976 $url = hash('md5', 'http://0.0.0.0/entry2'); 976 $url = hash('sha1', 'http://0.0.0.0/entry2');
977 977
978 return [ 978 return [
979 'with_id' => [ 979 'with_id' => [
@@ -1047,37 +1047,37 @@ class EntryRestControllerTest extends WallabagApiTestCase
1047 { 1047 {
1048 $url1 = 'http://0.0.0.0/entry2'; 1048 $url1 = 'http://0.0.0.0/entry2';
1049 $url2 = 'http://0.0.0.0/entry10'; 1049 $url2 = 'http://0.0.0.0/entry10';
1050 $this->client->request('GET', '/api/entries/exists?hashed_urls[]=' . hash('md5', $url1) . '&hashed_urls[]=' . hash('md5', $url2) . '&return_id=1'); 1050 $this->client->request('GET', '/api/entries/exists?hashed_urls[]=' . hash('sha1', $url1) . '&hashed_urls[]=' . hash('sha1', $url2) . '&return_id=1');
1051 1051
1052 $this->assertSame(200, $this->client->getResponse()->getStatusCode()); 1052 $this->assertSame(200, $this->client->getResponse()->getStatusCode());
1053 1053
1054 $content = json_decode($this->client->getResponse()->getContent(), true); 1054 $content = json_decode($this->client->getResponse()->getContent(), true);
1055 1055
1056 $this->assertArrayHasKey(hash('md5', $url1), $content); 1056 $this->assertArrayHasKey(hash('sha1', $url1), $content);
1057 $this->assertArrayHasKey(hash('md5', $url2), $content); 1057 $this->assertArrayHasKey(hash('sha1', $url2), $content);
1058 $this->assertSame(2, $content[hash('md5', $url1)]); 1058 $this->assertSame(2, $content[hash('sha1', $url1)]);
1059 $this->assertNull($content[hash('md5', $url2)]); 1059 $this->assertNull($content[hash('sha1', $url2)]);
1060 } 1060 }
1061 1061
1062 public function testGetEntriesExistsWithManyUrlsHashedReturnBool() 1062 public function testGetEntriesExistsWithManyUrlsHashedReturnBool()
1063 { 1063 {
1064 $url1 = 'http://0.0.0.0/entry2'; 1064 $url1 = 'http://0.0.0.0/entry2';
1065 $url2 = 'http://0.0.0.0/entry10'; 1065 $url2 = 'http://0.0.0.0/entry10';
1066 $this->client->request('GET', '/api/entries/exists?hashed_urls[]=' . hash('md5', $url1) . '&hashed_urls[]=' . hash('md5', $url2)); 1066 $this->client->request('GET', '/api/entries/exists?hashed_urls[]=' . hash('sha1', $url1) . '&hashed_urls[]=' . hash('sha1', $url2));
1067 1067
1068 $this->assertSame(200, $this->client->getResponse()->getStatusCode()); 1068 $this->assertSame(200, $this->client->getResponse()->getStatusCode());
1069 1069
1070 $content = json_decode($this->client->getResponse()->getContent(), true); 1070 $content = json_decode($this->client->getResponse()->getContent(), true);
1071 1071
1072 $this->assertArrayHasKey(hash('md5', $url1), $content); 1072 $this->assertArrayHasKey(hash('sha1', $url1), $content);
1073 $this->assertArrayHasKey(hash('md5', $url2), $content); 1073 $this->assertArrayHasKey(hash('sha1', $url2), $content);
1074 $this->assertTrue($content[hash('md5', $url1)]); 1074 $this->assertTrue($content[hash('sha1', $url1)]);
1075 $this->assertFalse($content[hash('md5', $url2)]); 1075 $this->assertFalse($content[hash('sha1', $url2)]);
1076 } 1076 }
1077 1077
1078 public function testGetEntriesExistsWhichDoesNotExists() 1078 public function testGetEntriesExistsWhichDoesNotExists()
1079 { 1079 {
1080 $this->client->request('GET', '/api/entries/exists?hashed_url=' . hash('md5', 'http://google.com/entry2')); 1080 $this->client->request('GET', '/api/entries/exists?hashed_url=' . hash('sha1', 'http://google.com/entry2'));
1081 1081
1082 $this->assertSame(200, $this->client->getResponse()->getStatusCode()); 1082 $this->assertSame(200, $this->client->getResponse()->getStatusCode());
1083 1083