Skip to content

Commit

Permalink
Fix deploy url
Browse files Browse the repository at this point in the history
  • Loading branch information
dnetix committed Jun 11, 2020
1 parent 8f13ff0 commit 2621ad8
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Sentry/SentryApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public function constructUrl(string $version = null): string
{
$url = self::API_URL . 'organizations/' . $this->organization . '/releases/';
if ($version) {
$url .= $version . 'deploys/';
$url .= $version . '/deploys/';
}
return $url;
}
Expand Down
7 changes: 7 additions & 0 deletions tests/Mocks/FakeSentryClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,13 @@ public function assertAuthenticationHeaderSent(string $token)
);
}

public function lastUrl(): string
{
Assert::assertGreaterThan(0, count($this->requests), 'There were no requests sent');

return Arr::last($this->requests)['fullUrl'];
}

public function lastRequest(): array
{
return array_pop($this->requests) ?: [];
Expand Down
3 changes: 2 additions & 1 deletion tests/Sentry/SentryApiTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,9 @@ public function can_create_a_sentry_deploy()
$this->bindSentryFakeClient();
$this->fakeClient->push('success_deploy');

$this->sentryApi()->createDeploy('asdfg2', 'local');
$this->sentryApi()->createDeploy('version-deployed', 'local');

$this->assertStringContainsString('releases/version-deployed/deploys/', $this->fakeClient->lastUrl());
$this->fakeClient->assertLastRequestHas('environment', 'local');
}
}

0 comments on commit 2621ad8

Please sign in to comment.