mirror of
https://github.com/shlinkio/shlink.git
synced 2025-02-17 15:59:56 +03:00
Added API test for editing tags with and without domain
This commit is contained in:
parent
e58f2a384e
commit
e87d4d61bc
1 changed files with 21 additions and 0 deletions
|
@ -41,4 +41,25 @@ class EditShortUrlTagsActionTest extends ApiTestCase
|
|||
$this->assertEquals('Short URL not found', $payload['title']);
|
||||
$this->assertEquals('invalid', $payload['shortCode']);
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function tagsAreSetOnProperShortUrlBasedOnProvidedDomain(): void
|
||||
{
|
||||
$urlWithoutDomain = '/short-urls/ghi789/tags';
|
||||
$urlWithDomain = $urlWithoutDomain . '?domain=example.com';
|
||||
|
||||
$setTagsWithDomain = $this->callApiWithKey(self::METHOD_PUT, $urlWithDomain, [RequestOptions::JSON => [
|
||||
'tags' => ['foo', 'bar'],
|
||||
]]);
|
||||
$fetchWithoutDomain = $this->getJsonResponsePayload(
|
||||
$this->callApiWithKey(self::METHOD_GET, '/short-urls/ghi789'),
|
||||
);
|
||||
$fetchWithDomain = $this->getJsonResponsePayload(
|
||||
$this->callApiWithKey(self::METHOD_GET, '/short-urls/ghi789?domain=example.com'),
|
||||
);
|
||||
|
||||
$this->assertEquals(self::STATUS_OK, $setTagsWithDomain->getStatusCode());
|
||||
$this->assertEquals([], $fetchWithoutDomain['tags']);
|
||||
$this->assertEquals(['bar', 'foo'], $fetchWithDomain['tags']);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue