Skip to content

Commit

Permalink
test(unit): streamline default value "for allow_multiple_user_back_ends"
Browse files Browse the repository at this point in the history
- getAppValue() returns strings

Signed-off-by: Arthur Schiwon <[email protected]>
  • Loading branch information
blizzz committed May 31, 2024
1 parent 1ca53c6 commit 8c1fa82
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions lib/Settings/Admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ public function getForm() {
'text' => $this->l10n->t('Only allow authentication if an account exists on some other backend (e.g. LDAP).', [$this->defaults->getName()]),
'type' => 'checkbox',
'global' => true,
'value' => $this->config->getAppValue('user_saml', 'general-require_provisioned_account', 0)
'value' => $this->config->getAppValue('user_saml', 'general-require_provisioned_account', '0')
];
$generalSettings['idp0_display_name'] = [
'text' => $this->l10n->t('Optional display name of the identity provider (default: "SSO & SAML log in")'),
Expand All @@ -204,7 +204,7 @@ public function getForm() {
'type' => 'checkbox',
'hideForEnv' => true,
'global' => true,
'value' => $this->config->getAppValue('user_saml', 'general-allow_multiple_user_back_ends')
'value' => $this->config->getAppValue('user_saml', 'general-allow_multiple_user_back_ends', '0')
];
}

Expand Down
8 changes: 4 additions & 4 deletions tests/unit/Settings/AdminTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -242,23 +242,23 @@ public function testGetFormWithSaml() {
2 => 'Provider 2',
]);
$this->config
->expects($this->exactly(4)) # mode + three global values
->expects($this->exactly(3)) # mode + three global values
->method('getAppValue')
->withConsecutive(
['user_saml', 'type'],
['user_saml', 'general-require_provisioned_account'],
['user_saml', 'general-allow_multiple_user_back_ends'],
)
->willReturnOnConsecutiveCalls('saml', 0, 0, '');
->willReturnOnConsecutiveCalls('saml', '0', '0');
$this->defaults
->expects($this->any())
->method('getName')
->willReturn('Nextcloud');

$params = $this->formDataProvider();
$params['type'] = 'saml';
$params['general']['require_provisioned_account']['value'] = 0;
$params['general']['allow_multiple_user_back_ends']['value'] = '';
$params['general']['require_provisioned_account']['value'] = '0';
$params['general']['allow_multiple_user_back_ends']['value'] = '0';

$expected = new TemplateResponse('user_saml', 'admin', $params);
$this->assertEquals($expected, $this->admin->getForm());
Expand Down

0 comments on commit 8c1fa82

Please sign in to comment.