Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
9 changes: 9 additions & 0 deletions lib/AppInfo/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
use OCA\User_SAML\Middleware\OnlyLoggedInMiddleware;
use OCA\User_SAML\SAMLSettings;
use OCA\User_SAML\Service\SessionService;
use OCA\User_SAML\Support\SystemReportSection;
use OCA\User_SAML\UserBackend;
use OCP\AppFramework\App;
use OCP\AppFramework\Bootstrap\IBootContext;
Expand Down Expand Up @@ -77,6 +78,14 @@ public function register(IRegistrationContext $context): void {
*/
$context->registerAlternativeLoginProvider(AlternativeLoginProvider::class);
}

if (method_exists($context, 'registerSystemReportSection')) {
/**
* @psalm-suppress UndefinedInterfaceMethod
* @psalm-suppress MissingDependency
*/
$context->registerSystemReportSection(SystemReportSection::class);
}
}

#[\Override]
Expand Down
91 changes: 91 additions & 0 deletions lib/Support/SystemReportSection.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
<?php

declare(strict_types=1);

/**
* SPDX-FileCopyrightText: 2026 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/

namespace OCA\User_SAML\Support;

use OCA\User_SAML\SAMLSettings;
use OCP\IL10N;
use OCP\SystemReport\ISystemReportSection;
use OCP\SystemReport\SystemReportDetail;
use OCP\SystemReport\SystemReportDetailFormat;

/**
* Contributes the configuration of every configured SAML provider to the
* system report generated by the support app.
*/
class SystemReportSection implements ISystemReportSection {

Check failure on line 22 in lib/Support/SystemReportSection.php

View workflow job for this annotation

GitHub Actions / static-psalm-analysis dev-stable33

UndefinedClass

lib/Support/SystemReportSection.php:22:38: UndefinedClass: Class, interface or enum named OCP\SystemReport\ISystemReportSection does not exist (see https://psalm.dev/019)

Check failure on line 22 in lib/Support/SystemReportSection.php

View workflow job for this annotation

GitHub Actions / static-psalm-analysis dev-stable34

UndefinedClass

lib/Support/SystemReportSection.php:22:38: UndefinedClass: Class, interface or enum named OCP\SystemReport\ISystemReportSection does not exist (see https://psalm.dev/019)

Check failure on line 22 in lib/Support/SystemReportSection.php

View workflow job for this annotation

GitHub Actions / static-psalm-analysis dev-master

UndefinedClass

lib/Support/SystemReportSection.php:22:38: UndefinedClass: Class, interface or enum named OCP\SystemReport\ISystemReportSection does not exist (see https://psalm.dev/019)

Check failure on line 22 in lib/Support/SystemReportSection.php

View workflow job for this annotation

GitHub Actions / static-psalm-analysis dev-stable32

UndefinedClass

lib/Support/SystemReportSection.php:22:38: UndefinedClass: Class, interface or enum named OCP\SystemReport\ISystemReportSection does not exist (see https://psalm.dev/019)

Check failure on line 22 in lib/Support/SystemReportSection.php

View workflow job for this annotation

GitHub Actions / static-psalm-analysis dev-stable35

UndefinedClass

lib/Support/SystemReportSection.php:22:38: UndefinedClass: Class, interface or enum named OCP\SystemReport\ISystemReportSection does not exist (see https://psalm.dev/019)
/**
* Keys from SAMLSettings::IDP_CONFIG_KEYS that must never end up in a
* system report, since it is commonly shared with third parties.
*/
private const SECRET_KEYS = [
'sp-privateKey',
];

/**
* Certificates are not secret, but reporting them in full only adds
* noise, so only whether one is configured is reported.
*/
private const PRESENCE_ONLY_KEYS = [
'idp-x509cert',
'sp-x509cert',
];

public function __construct(
private readonly SAMLSettings $samlSettings,
private readonly IL10N $l10n,
) {
}

#[\Override]
public function getId(): string {
return 'saml';
}

#[\Override]
public function getTitle(): string {
return $this->l10n->t('SAML');
}

#[\Override]
public function getDetails(): array {
$details = [];

foreach ($this->samlSettings->getListOfIdps() as $id => $displayName) {
$title = $displayName !== '' ? $displayName : $this->l10n->t('SAML provider #%s', [(string)$id]);
$details[] = new SystemReportDetail(
$title,
$this->renderConfig($this->samlSettings->get((int)$id)),
SystemReportDetailFormat::Preformatted,
);
}

return $details;
}

private function renderConfig(array $config): string {
$lines = [];
foreach (SAMLSettings::IDP_CONFIG_KEYS as $key) {
if (in_array($key, self::SECRET_KEYS, true)) {
continue;
}

$value = $config[$key] ?? '';
if (in_array($key, self::PRESENCE_ONLY_KEYS, true)) {
$value = $value !== '' ? 'configured' : 'not configured';
} elseif (is_array($value)) {
$value = implode(';', $value);
}

$lines[] = $key . ': ' . $value;
}

return implode("\n", $lines);
}
}
1 change: 1 addition & 0 deletions tests/unit/.phpunit.result.cache
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"version":2,"defects":{"OCA\\User_SAML\\Tests\\GroupManagerTest::testUpdateUserGroups":8,"OCA\\User_SAML\\Tests\\GroupManagerTest::testUnassignUserFromGroups":8,"OCA\\User_SAML\\Tests\\GroupManagerTest::testUnassignUserFromGroupsWithKeepEmpytGroups":8,"OCA\\User_SAML\\Tests\\GroupManagerTest::testAssignUserToGroups":8,"OCA\\User_SAML\\Tests\\GroupManagerTest::testAssignUserToNonExistingGroups":8,"OCA\\User_SAML\\Tests\\GroupManagerTest::testAssignUserToGroupsWithCollision":8,"OCA\\User_SAML\\Tests\\GroupManagerTest::testHasGroupForeignMembersWithOnlySamlUsers":8,"OCA\\User_SAML\\Tests\\GroupManagerTest::testHasGroupForeignMembersWithForeignMember":8,"OCA\\User_SAML\\Tests\\GroupManagerTest::testHasGroupForeignMembersWithNoMembers":8,"OCA\\User_SAML\\Tests\\Support\\SystemReportSectionTest::testGetIdAndTitle":8,"OCA\\User_SAML\\Tests\\Support\\SystemReportSectionTest::testGetDetailsReturnsNothingWithoutConfiguredIdps":8,"OCA\\User_SAML\\Tests\\Support\\SystemReportSectionTest::testGetDetailsNeverIncludesThePrivateKey":8,"OCA\\User_SAML\\Tests\\Support\\SystemReportSectionTest::testGetDetailsOnlyReportsCertificatePresence":8,"OCA\\User_SAML\\Tests\\Support\\SystemReportSectionTest::testGetDetailsUsesFallbackTitleWhenDisplayNameIsEmpty":8,"OCA\\User_SAML\\Tests\\Support\\SystemReportSectionTest::testGetDetailsUsesPreformattedFormat":8},"times":[]}
102 changes: 102 additions & 0 deletions tests/unit/Support/SystemReportSectionTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
<?php

declare(strict_types=1);

/**
* SPDX-FileCopyrightText: 2026 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/

namespace OCA\User_SAML\Tests\Support;

use OCA\User_SAML\SAMLSettings;
use OCA\User_SAML\Support\SystemReportSection;
use OCP\IL10N;
use OCP\SystemReport\SystemReportDetailFormat;
use PHPUnit\Framework\MockObject\MockObject;
use Test\TestCase;

class SystemReportSectionTest extends TestCase {
private SAMLSettings&MockObject $samlSettings;
private IL10N&MockObject $l10n;
private SystemReportSection $section;

Check failure on line 22 in tests/unit/Support/SystemReportSectionTest.php

View workflow job for this annotation

GitHub Actions / static-psalm-analysis dev-stable33

MissingDependency

tests/unit/Support/SystemReportSectionTest.php:22:10: MissingDependency: OCA\User_SAML\Support\SystemReportSection depends on class or interface ocp\systemreport\isystemreportsection that does not exist (see https://psalm.dev/157)

Check failure on line 22 in tests/unit/Support/SystemReportSectionTest.php

View workflow job for this annotation

GitHub Actions / static-psalm-analysis dev-stable34

MissingDependency

tests/unit/Support/SystemReportSectionTest.php:22:10: MissingDependency: OCA\User_SAML\Support\SystemReportSection depends on class or interface ocp\systemreport\isystemreportsection that does not exist (see https://psalm.dev/157)

Check failure on line 22 in tests/unit/Support/SystemReportSectionTest.php

View workflow job for this annotation

GitHub Actions / static-psalm-analysis dev-master

MissingDependency

tests/unit/Support/SystemReportSectionTest.php:22:10: MissingDependency: OCA\User_SAML\Support\SystemReportSection depends on class or interface ocp\systemreport\isystemreportsection that does not exist (see https://psalm.dev/157)

Check failure on line 22 in tests/unit/Support/SystemReportSectionTest.php

View workflow job for this annotation

GitHub Actions / static-psalm-analysis dev-stable32

MissingDependency

tests/unit/Support/SystemReportSectionTest.php:22:10: MissingDependency: OCA\User_SAML\Support\SystemReportSection depends on class or interface ocp\systemreport\isystemreportsection that does not exist (see https://psalm.dev/157)

Check failure on line 22 in tests/unit/Support/SystemReportSectionTest.php

View workflow job for this annotation

GitHub Actions / static-psalm-analysis dev-stable35

MissingDependency

tests/unit/Support/SystemReportSectionTest.php:22:10: MissingDependency: OCA\User_SAML\Support\SystemReportSection depends on class or interface ocp\systemreport\isystemreportsection that does not exist (see https://psalm.dev/157)

#[\Override]
protected function setUp(): void {
parent::setUp();

$this->samlSettings = $this->createMock(SAMLSettings::class);
$this->l10n = $this->createMock(IL10N::class);
$this->l10n->method('t')
->willReturnCallback(fn (string $text, array $parameters = []) => vsprintf($text, $parameters));

$this->section = new SystemReportSection(

Check failure on line 33 in tests/unit/Support/SystemReportSectionTest.php

View workflow job for this annotation

GitHub Actions / static-psalm-analysis dev-stable33

MissingDependency

tests/unit/Support/SystemReportSectionTest.php:33:24: MissingDependency: OCA\User_SAML\Support\SystemReportSection depends on class or interface ocp\systemreport\isystemreportsection that does not exist (see https://psalm.dev/157)

Check failure on line 33 in tests/unit/Support/SystemReportSectionTest.php

View workflow job for this annotation

GitHub Actions / static-psalm-analysis dev-stable34

MissingDependency

tests/unit/Support/SystemReportSectionTest.php:33:24: MissingDependency: OCA\User_SAML\Support\SystemReportSection depends on class or interface ocp\systemreport\isystemreportsection that does not exist (see https://psalm.dev/157)

Check failure on line 33 in tests/unit/Support/SystemReportSectionTest.php

View workflow job for this annotation

GitHub Actions / static-psalm-analysis dev-master

MissingDependency

tests/unit/Support/SystemReportSectionTest.php:33:24: MissingDependency: OCA\User_SAML\Support\SystemReportSection depends on class or interface ocp\systemreport\isystemreportsection that does not exist (see https://psalm.dev/157)

Check failure on line 33 in tests/unit/Support/SystemReportSectionTest.php

View workflow job for this annotation

GitHub Actions / static-psalm-analysis dev-stable32

MissingDependency

tests/unit/Support/SystemReportSectionTest.php:33:24: MissingDependency: OCA\User_SAML\Support\SystemReportSection depends on class or interface ocp\systemreport\isystemreportsection that does not exist (see https://psalm.dev/157)

Check failure on line 33 in tests/unit/Support/SystemReportSectionTest.php

View workflow job for this annotation

GitHub Actions / static-psalm-analysis dev-stable35

MissingDependency

tests/unit/Support/SystemReportSectionTest.php:33:24: MissingDependency: OCA\User_SAML\Support\SystemReportSection depends on class or interface ocp\systemreport\isystemreportsection that does not exist (see https://psalm.dev/157)
$this->samlSettings,
$this->l10n,
);
}

public function testGetIdAndTitle(): void {
$this->assertSame('saml', $this->section->getId());

Check failure on line 40 in tests/unit/Support/SystemReportSectionTest.php

View workflow job for this annotation

GitHub Actions / static-psalm-analysis dev-stable33

MissingDependency

tests/unit/Support/SystemReportSectionTest.php:40:29: MissingDependency: OCA\User_SAML\Support\SystemReportSection depends on class or interface ocp\systemreport\isystemreportsection that does not exist (see https://psalm.dev/157)

Check failure on line 40 in tests/unit/Support/SystemReportSectionTest.php

View workflow job for this annotation

GitHub Actions / static-psalm-analysis dev-stable34

MissingDependency

tests/unit/Support/SystemReportSectionTest.php:40:29: MissingDependency: OCA\User_SAML\Support\SystemReportSection depends on class or interface ocp\systemreport\isystemreportsection that does not exist (see https://psalm.dev/157)

Check failure on line 40 in tests/unit/Support/SystemReportSectionTest.php

View workflow job for this annotation

GitHub Actions / static-psalm-analysis dev-master

MissingDependency

tests/unit/Support/SystemReportSectionTest.php:40:29: MissingDependency: OCA\User_SAML\Support\SystemReportSection depends on class or interface ocp\systemreport\isystemreportsection that does not exist (see https://psalm.dev/157)

Check failure on line 40 in tests/unit/Support/SystemReportSectionTest.php

View workflow job for this annotation

GitHub Actions / static-psalm-analysis dev-stable32

MissingDependency

tests/unit/Support/SystemReportSectionTest.php:40:29: MissingDependency: OCA\User_SAML\Support\SystemReportSection depends on class or interface ocp\systemreport\isystemreportsection that does not exist (see https://psalm.dev/157)

Check failure on line 40 in tests/unit/Support/SystemReportSectionTest.php

View workflow job for this annotation

GitHub Actions / static-psalm-analysis dev-stable35

MissingDependency

tests/unit/Support/SystemReportSectionTest.php:40:29: MissingDependency: OCA\User_SAML\Support\SystemReportSection depends on class or interface ocp\systemreport\isystemreportsection that does not exist (see https://psalm.dev/157)
$this->assertSame('SAML', $this->section->getTitle());

Check failure on line 41 in tests/unit/Support/SystemReportSectionTest.php

View workflow job for this annotation

GitHub Actions / static-psalm-analysis dev-stable33

MissingDependency

tests/unit/Support/SystemReportSectionTest.php:41:29: MissingDependency: OCA\User_SAML\Support\SystemReportSection depends on class or interface ocp\systemreport\isystemreportsection that does not exist (see https://psalm.dev/157)

Check failure on line 41 in tests/unit/Support/SystemReportSectionTest.php

View workflow job for this annotation

GitHub Actions / static-psalm-analysis dev-stable34

MissingDependency

tests/unit/Support/SystemReportSectionTest.php:41:29: MissingDependency: OCA\User_SAML\Support\SystemReportSection depends on class or interface ocp\systemreport\isystemreportsection that does not exist (see https://psalm.dev/157)

Check failure on line 41 in tests/unit/Support/SystemReportSectionTest.php

View workflow job for this annotation

GitHub Actions / static-psalm-analysis dev-master

MissingDependency

tests/unit/Support/SystemReportSectionTest.php:41:29: MissingDependency: OCA\User_SAML\Support\SystemReportSection depends on class or interface ocp\systemreport\isystemreportsection that does not exist (see https://psalm.dev/157)

Check failure on line 41 in tests/unit/Support/SystemReportSectionTest.php

View workflow job for this annotation

GitHub Actions / static-psalm-analysis dev-stable32

MissingDependency

tests/unit/Support/SystemReportSectionTest.php:41:29: MissingDependency: OCA\User_SAML\Support\SystemReportSection depends on class or interface ocp\systemreport\isystemreportsection that does not exist (see https://psalm.dev/157)

Check failure on line 41 in tests/unit/Support/SystemReportSectionTest.php

View workflow job for this annotation

GitHub Actions / static-psalm-analysis dev-stable35

MissingDependency

tests/unit/Support/SystemReportSectionTest.php:41:29: MissingDependency: OCA\User_SAML\Support\SystemReportSection depends on class or interface ocp\systemreport\isystemreportsection that does not exist (see https://psalm.dev/157)
}

public function testGetDetailsReturnsNothingWithoutConfiguredIdps(): void {
$this->samlSettings->method('getListOfIdps')
->willReturn([]);

$this->assertSame([], $this->section->getDetails());

Check failure on line 48 in tests/unit/Support/SystemReportSectionTest.php

View workflow job for this annotation

GitHub Actions / static-psalm-analysis dev-stable33

MissingDependency

tests/unit/Support/SystemReportSectionTest.php:48:25: MissingDependency: OCA\User_SAML\Support\SystemReportSection depends on class or interface ocp\systemreport\isystemreportsection that does not exist (see https://psalm.dev/157)

Check failure on line 48 in tests/unit/Support/SystemReportSectionTest.php

View workflow job for this annotation

GitHub Actions / static-psalm-analysis dev-stable34

MissingDependency

tests/unit/Support/SystemReportSectionTest.php:48:25: MissingDependency: OCA\User_SAML\Support\SystemReportSection depends on class or interface ocp\systemreport\isystemreportsection that does not exist (see https://psalm.dev/157)

Check failure on line 48 in tests/unit/Support/SystemReportSectionTest.php

View workflow job for this annotation

GitHub Actions / static-psalm-analysis dev-master

MissingDependency

tests/unit/Support/SystemReportSectionTest.php:48:25: MissingDependency: OCA\User_SAML\Support\SystemReportSection depends on class or interface ocp\systemreport\isystemreportsection that does not exist (see https://psalm.dev/157)

Check failure on line 48 in tests/unit/Support/SystemReportSectionTest.php

View workflow job for this annotation

GitHub Actions / static-psalm-analysis dev-stable32

MissingDependency

tests/unit/Support/SystemReportSectionTest.php:48:25: MissingDependency: OCA\User_SAML\Support\SystemReportSection depends on class or interface ocp\systemreport\isystemreportsection that does not exist (see https://psalm.dev/157)

Check failure on line 48 in tests/unit/Support/SystemReportSectionTest.php

View workflow job for this annotation

GitHub Actions / static-psalm-analysis dev-stable35

MissingDependency

tests/unit/Support/SystemReportSectionTest.php:48:25: MissingDependency: OCA\User_SAML\Support\SystemReportSection depends on class or interface ocp\systemreport\isystemreportsection that does not exist (see https://psalm.dev/157)
}

public function testGetDetailsNeverIncludesThePrivateKey(): void {
$this->samlSettings->method('getListOfIdps')
->willReturn([1 => 'My IdP']);
$this->samlSettings->method('get')
->with(1)
->willReturn([
'idp-entityId' => 'https://idp.example.com',
'sp-privateKey' => 'super-secret-private-key',
]);

$details = $this->section->getDetails();

Check failure on line 61 in tests/unit/Support/SystemReportSectionTest.php

View workflow job for this annotation

GitHub Actions / static-psalm-analysis dev-stable33

MissingDependency

tests/unit/Support/SystemReportSectionTest.php:61:14: MissingDependency: OCA\User_SAML\Support\SystemReportSection depends on class or interface ocp\systemreport\isystemreportsection that does not exist (see https://psalm.dev/157)

Check failure on line 61 in tests/unit/Support/SystemReportSectionTest.php

View workflow job for this annotation

GitHub Actions / static-psalm-analysis dev-stable34

MissingDependency

tests/unit/Support/SystemReportSectionTest.php:61:14: MissingDependency: OCA\User_SAML\Support\SystemReportSection depends on class or interface ocp\systemreport\isystemreportsection that does not exist (see https://psalm.dev/157)

Check failure on line 61 in tests/unit/Support/SystemReportSectionTest.php

View workflow job for this annotation

GitHub Actions / static-psalm-analysis dev-master

MissingDependency

tests/unit/Support/SystemReportSectionTest.php:61:14: MissingDependency: OCA\User_SAML\Support\SystemReportSection depends on class or interface ocp\systemreport\isystemreportsection that does not exist (see https://psalm.dev/157)

Check failure on line 61 in tests/unit/Support/SystemReportSectionTest.php

View workflow job for this annotation

GitHub Actions / static-psalm-analysis dev-stable32

MissingDependency

tests/unit/Support/SystemReportSectionTest.php:61:14: MissingDependency: OCA\User_SAML\Support\SystemReportSection depends on class or interface ocp\systemreport\isystemreportsection that does not exist (see https://psalm.dev/157)

Check failure on line 61 in tests/unit/Support/SystemReportSectionTest.php

View workflow job for this annotation

GitHub Actions / static-psalm-analysis dev-stable35

MissingDependency

tests/unit/Support/SystemReportSectionTest.php:61:14: MissingDependency: OCA\User_SAML\Support\SystemReportSection depends on class or interface ocp\systemreport\isystemreportsection that does not exist (see https://psalm.dev/157)
$this->assertCount(1, $details);
$this->assertStringNotContainsString('super-secret-private-key', $details[0]->getContent());

Check failure on line 63 in tests/unit/Support/SystemReportSectionTest.php

View workflow job for this annotation

GitHub Actions / static-psalm-analysis dev-stable33

PossiblyInvalidArrayAccess

tests/unit/Support/SystemReportSectionTest.php:63:68: PossiblyInvalidArrayAccess: Cannot access array value on non-array variable $details of type iterable<mixed, mixed> (see https://psalm.dev/109)

Check failure on line 63 in tests/unit/Support/SystemReportSectionTest.php

View workflow job for this annotation

GitHub Actions / static-psalm-analysis dev-stable33

UndefinedInterfaceMethod

tests/unit/Support/SystemReportSectionTest.php:63:68: UndefinedInterfaceMethod: Method Countable::offsetGet does not exist (see https://psalm.dev/181)

Check failure on line 63 in tests/unit/Support/SystemReportSectionTest.php

View workflow job for this annotation

GitHub Actions / static-psalm-analysis dev-stable34

PossiblyInvalidArrayAccess

tests/unit/Support/SystemReportSectionTest.php:63:68: PossiblyInvalidArrayAccess: Cannot access array value on non-array variable $details of type iterable<mixed, mixed> (see https://psalm.dev/109)

Check failure on line 63 in tests/unit/Support/SystemReportSectionTest.php

View workflow job for this annotation

GitHub Actions / static-psalm-analysis dev-stable34

UndefinedInterfaceMethod

tests/unit/Support/SystemReportSectionTest.php:63:68: UndefinedInterfaceMethod: Method Countable::offsetGet does not exist (see https://psalm.dev/181)

Check failure on line 63 in tests/unit/Support/SystemReportSectionTest.php

View workflow job for this annotation

GitHub Actions / static-psalm-analysis dev-master

PossiblyInvalidArrayAccess

tests/unit/Support/SystemReportSectionTest.php:63:68: PossiblyInvalidArrayAccess: Cannot access array value on non-array variable $details of type iterable<mixed, mixed> (see https://psalm.dev/109)

Check failure on line 63 in tests/unit/Support/SystemReportSectionTest.php

View workflow job for this annotation

GitHub Actions / static-psalm-analysis dev-master

UndefinedInterfaceMethod

tests/unit/Support/SystemReportSectionTest.php:63:68: UndefinedInterfaceMethod: Method Countable::offsetGet does not exist (see https://psalm.dev/181)

Check failure on line 63 in tests/unit/Support/SystemReportSectionTest.php

View workflow job for this annotation

GitHub Actions / static-psalm-analysis dev-stable32

PossiblyInvalidArrayAccess

tests/unit/Support/SystemReportSectionTest.php:63:68: PossiblyInvalidArrayAccess: Cannot access array value on non-array variable $details of type iterable<mixed, mixed> (see https://psalm.dev/109)

Check failure on line 63 in tests/unit/Support/SystemReportSectionTest.php

View workflow job for this annotation

GitHub Actions / static-psalm-analysis dev-stable32

UndefinedInterfaceMethod

tests/unit/Support/SystemReportSectionTest.php:63:68: UndefinedInterfaceMethod: Method Countable::offsetGet does not exist (see https://psalm.dev/181)

Check failure on line 63 in tests/unit/Support/SystemReportSectionTest.php

View workflow job for this annotation

GitHub Actions / static-psalm-analysis dev-stable35

PossiblyInvalidArrayAccess

tests/unit/Support/SystemReportSectionTest.php:63:68: PossiblyInvalidArrayAccess: Cannot access array value on non-array variable $details of type iterable<mixed, mixed> (see https://psalm.dev/109)

Check failure on line 63 in tests/unit/Support/SystemReportSectionTest.php

View workflow job for this annotation

GitHub Actions / static-psalm-analysis dev-stable35

UndefinedInterfaceMethod

tests/unit/Support/SystemReportSectionTest.php:63:68: UndefinedInterfaceMethod: Method Countable::offsetGet does not exist (see https://psalm.dev/181)
$this->assertStringContainsString('idp-entityId: https://idp.example.com', $details[0]->getContent());

Check failure on line 64 in tests/unit/Support/SystemReportSectionTest.php

View workflow job for this annotation

GitHub Actions / static-psalm-analysis dev-stable33

UndefinedInterfaceMethod

tests/unit/Support/SystemReportSectionTest.php:64:78: UndefinedInterfaceMethod: Method Countable::offsetGet does not exist (see https://psalm.dev/181)

Check failure on line 64 in tests/unit/Support/SystemReportSectionTest.php

View workflow job for this annotation

GitHub Actions / static-psalm-analysis dev-stable34

UndefinedInterfaceMethod

tests/unit/Support/SystemReportSectionTest.php:64:78: UndefinedInterfaceMethod: Method Countable::offsetGet does not exist (see https://psalm.dev/181)

Check failure on line 64 in tests/unit/Support/SystemReportSectionTest.php

View workflow job for this annotation

GitHub Actions / static-psalm-analysis dev-master

UndefinedInterfaceMethod

tests/unit/Support/SystemReportSectionTest.php:64:78: UndefinedInterfaceMethod: Method Countable::offsetGet does not exist (see https://psalm.dev/181)

Check failure on line 64 in tests/unit/Support/SystemReportSectionTest.php

View workflow job for this annotation

GitHub Actions / static-psalm-analysis dev-stable32

UndefinedInterfaceMethod

tests/unit/Support/SystemReportSectionTest.php:64:78: UndefinedInterfaceMethod: Method Countable::offsetGet does not exist (see https://psalm.dev/181)

Check failure on line 64 in tests/unit/Support/SystemReportSectionTest.php

View workflow job for this annotation

GitHub Actions / static-psalm-analysis dev-stable35

UndefinedInterfaceMethod

tests/unit/Support/SystemReportSectionTest.php:64:78: UndefinedInterfaceMethod: Method Countable::offsetGet does not exist (see https://psalm.dev/181)
}

public function testGetDetailsOnlyReportsCertificatePresence(): void {
$this->samlSettings->method('getListOfIdps')
->willReturn([1 => 'My IdP']);
$this->samlSettings->method('get')
->with(1)
->willReturn([
'idp-x509cert' => '-----BEGIN CERTIFICATE-----MIIB...-----END CERTIFICATE-----',
'sp-x509cert' => '',
]);

$content = $this->section->getDetails()[0]->getContent();
$this->assertStringNotContainsString('BEGIN CERTIFICATE', $content);
$this->assertStringContainsString('idp-x509cert: configured', $content);
$this->assertStringContainsString('sp-x509cert: not configured', $content);
}

public function testGetDetailsUsesFallbackTitleWhenDisplayNameIsEmpty(): void {
$this->samlSettings->method('getListOfIdps')
->willReturn([3 => '']);
$this->samlSettings->method('get')
->with(3)
->willReturn([]);

$this->assertSame('SAML provider #3', $this->section->getDetails()[0]->getTitle());
}

public function testGetDetailsUsesPreformattedFormat(): void {
$this->samlSettings->method('getListOfIdps')
->willReturn([1 => 'My IdP']);
$this->samlSettings->method('get')
->with(1)
->willReturn([]);

$this->assertSame(SystemReportDetailFormat::Preformatted, $this->section->getDetails()[0]->getFormat());
}
}
Loading