Skip to content

Commit

Permalink
fix: Fix ocm-provider setup check failure detection
Browse files Browse the repository at this point in the history
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
  • Loading branch information
come-nc authored and susnux committed Mar 13, 2024
1 parent a47a1e6 commit 1fffdf4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion apps/settings/lib/SetupChecks/OcxProviders.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public function run(): SetupResult {
];

foreach ($providers as $provider) {
foreach ($this->runHEAD($this->urlGenerator->getWebroot() . $provider) as $response) {
foreach ($this->runRequest('HEAD', $this->urlGenerator->getWebroot() . $provider, ['httpErrors' => false]) as $response) {
$testedProviders[$provider] = true;
if ($response->getStatusCode() === 200) {
$workingProviders[] = $provider;
Expand Down
14 changes: 7 additions & 7 deletions apps/settings/tests/SetupChecks/OcxProvicersTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ protected function setUp(): void {
$this->logger = $this->createMock(LoggerInterface::class);

$this->setupcheck = $this->getMockBuilder(OcxProviders::class)
->onlyMethods(['runHEAD'])
->onlyMethods(['runRequest'])
->setConstructorArgs([
$this->l10n,
$this->config,
Expand All @@ -79,7 +79,7 @@ public function testSuccess(): void {

$this->setupcheck
->expects($this->exactly(2))
->method('runHEAD')
->method('runRequest')
->willReturnOnConsecutiveCalls($this->generate([$response]), $this->generate([$response]));

$result = $this->setupcheck->run();
Expand All @@ -94,7 +94,7 @@ public function testLateSuccess(): void {

$this->setupcheck
->expects($this->exactly(2))
->method('runHEAD')
->method('runRequest')
->willReturnOnConsecutiveCalls($this->generate([$response1, $response1, $response1]), $this->generate([$response2])); // only one response out of two

$result = $this->setupcheck->run();
Expand All @@ -107,7 +107,7 @@ public function testNoResponse(): void {

$this->setupcheck
->expects($this->exactly(2))
->method('runHEAD')
->method('runRequest')
->willReturnOnConsecutiveCalls($this->generate([]), $this->generate([])); // No responses

$result = $this->setupcheck->run();
Expand All @@ -121,7 +121,7 @@ public function testPartialResponse(): void {

$this->setupcheck
->expects($this->exactly(2))
->method('runHEAD')
->method('runRequest')
->willReturnOnConsecutiveCalls($this->generate([$response]), $this->generate([])); // only one response out of two

$result = $this->setupcheck->run();
Expand All @@ -135,7 +135,7 @@ public function testInvalidResponse(): void {

$this->setupcheck
->expects($this->exactly(2))
->method('runHEAD')
->method('runRequest')
->willReturnOnConsecutiveCalls($this->generate([$response]), $this->generate([$response])); // only one response out of two

$result = $this->setupcheck->run();
Expand All @@ -151,7 +151,7 @@ public function testPartialInvalidResponse(): void {

$this->setupcheck
->expects($this->exactly(2))
->method('runHEAD')
->method('runRequest')
->willReturnOnConsecutiveCalls($this->generate([$response1]), $this->generate([$response2]));

$result = $this->setupcheck->run();
Expand Down

0 comments on commit 1fffdf4

Please sign in to comment.