aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/api/controllers/links/PostLinkTest.php
diff options
context:
space:
mode:
authorArthurHoaro <arthur@hoa.ro>2020-10-29 16:03:07 +0100
committerGitHub <noreply@github.com>2020-10-29 16:03:07 +0100
commitdff039092d180fffa89e7d88f7a4b7bc24dfc80f (patch)
tree7430bf86688b136e442774b1035a9c3be2418875 /tests/api/controllers/links/PostLinkTest.php
parent14c9370b4f712c8f5b48d46535cc3e8e5506c68a (diff)
parentb37ca790729125fa0df956220a4062f1d34c57e7 (diff)
downloadShaarli-dff039092d180fffa89e7d88f7a4b7bc24dfc80f.tar.gz
Shaarli-dff039092d180fffa89e7d88f7a4b7bc24dfc80f.tar.zst
Shaarli-dff039092d180fffa89e7d88f7a4b7bc24dfc80f.zip
Merge pull request #1616 from dimtion/fix-api-redirect
API postLink: change relative path to absolute path
Diffstat (limited to 'tests/api/controllers/links/PostLinkTest.php')
-rw-r--r--tests/api/controllers/links/PostLinkTest.php8
1 files changed, 4 insertions, 4 deletions
diff --git a/tests/api/controllers/links/PostLinkTest.php b/tests/api/controllers/links/PostLinkTest.php
index 7ff92f5c..e12f803b 100644
--- a/tests/api/controllers/links/PostLinkTest.php
+++ b/tests/api/controllers/links/PostLinkTest.php
@@ -92,8 +92,8 @@ class PostLinkTest extends TestCase
92 92
93 $mock = $this->createMock(Router::class); 93 $mock = $this->createMock(Router::class);
94 $mock->expects($this->any()) 94 $mock->expects($this->any())
95 ->method('relativePathFor') 95 ->method('pathFor')
96 ->willReturn('api/v1/bookmarks/1'); 96 ->willReturn('/api/v1/bookmarks/1');
97 97
98 // affect @property-read... seems to work 98 // affect @property-read... seems to work
99 $this->controller->getCi()->router = $mock; 99 $this->controller->getCi()->router = $mock;
@@ -128,7 +128,7 @@ class PostLinkTest extends TestCase
128 128
129 $response = $this->controller->postLink($request, new Response()); 129 $response = $this->controller->postLink($request, new Response());
130 $this->assertEquals(201, $response->getStatusCode()); 130 $this->assertEquals(201, $response->getStatusCode());
131 $this->assertEquals('api/v1/bookmarks/1', $response->getHeader('Location')[0]); 131 $this->assertEquals('/api/v1/bookmarks/1', $response->getHeader('Location')[0]);
132 $data = json_decode((string) $response->getBody(), true); 132 $data = json_decode((string) $response->getBody(), true);
133 $this->assertEquals(self::NB_FIELDS_LINK, count($data)); 133 $this->assertEquals(self::NB_FIELDS_LINK, count($data));
134 $this->assertEquals(43, $data['id']); 134 $this->assertEquals(43, $data['id']);
@@ -175,7 +175,7 @@ class PostLinkTest extends TestCase
175 $response = $this->controller->postLink($request, new Response()); 175 $response = $this->controller->postLink($request, new Response());
176 176
177 $this->assertEquals(201, $response->getStatusCode()); 177 $this->assertEquals(201, $response->getStatusCode());
178 $this->assertEquals('api/v1/bookmarks/1', $response->getHeader('Location')[0]); 178 $this->assertEquals('/api/v1/bookmarks/1', $response->getHeader('Location')[0]);
179 $data = json_decode((string) $response->getBody(), true); 179 $data = json_decode((string) $response->getBody(), true);
180 $this->assertEquals(self::NB_FIELDS_LINK, count($data)); 180 $this->assertEquals(self::NB_FIELDS_LINK, count($data));
181 $this->assertEquals(43, $data['id']); 181 $this->assertEquals(43, $data['id']);