-
Notifications
You must be signed in to change notification settings - Fork 110
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
327 additions
and
377 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
parameters: | ||
log.handler: 'stderr' | ||
log.level: 'error' | ||
satis_filename: "vfs://root/satis.json" | ||
satis_log_path: "vfs://root/satis/" | ||
admin.auth: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,13 +31,13 @@ public function testInvalidRequest($request): void | |
$handler->getResponse($request); | ||
} | ||
|
||
public function invalidRequestProvider(): \Generator | ||
public static function invalidRequestProvider(): \Generator | ||
{ | ||
yield [$this->createRequest([], '')]; | ||
yield [self::createRequest([], '')]; | ||
|
||
yield [$this->createRequest([])]; | ||
yield [self::createRequest([])]; | ||
|
||
yield [$this->createRequest(['repository' => []])]; | ||
yield [self::createRequest(['repository' => []])]; | ||
} | ||
|
||
public function testValidRequest(): void | ||
|
@@ -60,7 +60,7 @@ function ($args) { | |
) | ||
->shouldBeCalledTimes(1); | ||
|
||
$request = $this->createRequest(file_get_contents(__DIR__ . '/../../../fixtures/gitlab-push.json')); | ||
$request = self::createRequest(file_get_contents(__DIR__ . '/../../../fixtures/gitlab-push.json')); | ||
$handler = new GitlabWebhook($manager->reveal(), $dispatcher->reveal()); | ||
$response = $handler->getResponse($request); | ||
|
||
|
@@ -92,7 +92,7 @@ function ($args) { | |
) | ||
->shouldBeCalledTimes(1); | ||
|
||
$request = $this->createRequest(file_get_contents(__DIR__ . '/../../../fixtures/gitlab-push-nonexistant.json')); | ||
$request = self::createRequest(file_get_contents(__DIR__ . '/../../../fixtures/gitlab-push-nonexistant.json')); | ||
$handler = new GitlabWebhook($manager->reveal(), $dispatcher->reveal(), null, true); | ||
$response = $handler->getResponse($request); | ||
|
||
|
@@ -120,7 +120,7 @@ function ($args) { | |
) | ||
->shouldBeCalledTimes(1); | ||
|
||
$request = $this->createRequest(file_get_contents(__DIR__ . '/../../../fixtures/gitlab-push-deprecated.json')); | ||
$request = self::createRequest(file_get_contents(__DIR__ . '/../../../fixtures/gitlab-push-deprecated.json')); | ||
$handler = new GitlabWebhook($manager->reveal(), $dispatcher->reveal()); | ||
$response = $handler->getResponse($request); | ||
|
||
|
@@ -142,7 +142,7 @@ public function testInvalidTokenRequest(): void | |
|
||
$this->expectException(BadRequestHttpException::class); | ||
$this->expectExceptionMessage('Invalid Token'); | ||
$request = $this->createRequest(file_get_contents(__DIR__ . '/../../../fixtures/gitlab-push.json'), 'push', 'invalid-token'); | ||
$request = self::createRequest(file_get_contents(__DIR__ . '/../../../fixtures/gitlab-push.json'), 'push', 'invalid-token'); | ||
$handler = new GitlabWebhook($manager->reveal(), $dispatcher->reveal()); | ||
$response = $handler->getResponse($request); | ||
|
||
|
@@ -152,7 +152,7 @@ public function testInvalidTokenRequest(): void | |
public function testAutoAddOnlyHttp(): void | ||
{ | ||
$url = 'https://gitlab.com/example/nonexistant.git'; | ||
$request = $this->createRequest([ | ||
$request = self::createRequest([ | ||
'project' => [ | ||
'git_http_url' => $url, | ||
], | ||
|
@@ -184,7 +184,7 @@ public function testAutoAddPreferSsh(): void | |
{ | ||
$httpUrl = 'https://gitlab.com/example/nonexistant.git'; | ||
$sshUrl = '[email protected]:example/nonexistant.git'; | ||
$request = $this->createRequest([ | ||
$request = self::createRequest([ | ||
'project' => [ | ||
'git_http_url' => $httpUrl, | ||
'git_ssh_url' => $sshUrl, | ||
|
@@ -215,7 +215,7 @@ public function testAutoAddPreferSsh(): void | |
public function testAutoAddPreferSshFallback(): void | ||
{ | ||
$httpUrl = 'https://gitlab.com/example/nonexistant.git'; | ||
$request = $this->createRequest([ | ||
$request = self::createRequest([ | ||
'project' => [ | ||
'git_http_url' => $httpUrl, | ||
], | ||
|
@@ -243,7 +243,7 @@ public function testAutoAddPreferHttps(): void | |
{ | ||
$httpUrl = 'https://gitlab.com/example/nonexistant.git'; | ||
$sshUrl = '[email protected]:example/nonexistant.git'; | ||
$request = $this->createRequest([ | ||
$request = self::createRequest([ | ||
'project' => [ | ||
'git_http_url' => $httpUrl, | ||
'git_ssh_url' => $sshUrl, | ||
|
@@ -274,7 +274,7 @@ public function testAutoAddPreferHttps(): void | |
public function testAutoAddPreferHttpsFallback(): void | ||
{ | ||
$sshUrl = '[email protected]:example/nonexistant.git'; | ||
$request = $this->createRequest([ | ||
$request = self::createRequest([ | ||
'project' => [ | ||
'git_ssh_url' => $sshUrl, | ||
], | ||
|
@@ -299,7 +299,7 @@ public function testAutoAddPreferHttpsFallback(): void | |
$response = $handler->getResponse($request); | ||
} | ||
|
||
protected function createRequest($content, string $event = 'push', ?string $token = null): Request | ||
protected static function createRequest($content, string $event = 'push', ?string $token = null): Request | ||
{ | ||
if (!is_string($content)) { | ||
$content = json_encode($content); | ||
|