Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix: Fix ocm-provider setup check failure detection
Signed-off-by: Côme Chilliet <[email protected]>
  • Loading branch information
come-nc authored and susnux committed Mar 13, 2024
commit 1fffdf4763c04a04ba5defb53d6df451fe2a75f9
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) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If that is removed, then drop also runHEAD function?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still used in other checks I think but yeah we could move all of them.

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