Skip to content

Commit cb1cd8b

Browse files
committed
update tests
1 parent 6592987 commit cb1cd8b

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

test/functional/LoginShellSetTest.php

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -28,19 +28,22 @@ public static function getShells()
2828
// phpcs:enable
2929
}
3030

31+
private function isShellValid(string $shell)
32+
{
33+
return (
34+
(mb_check_encoding($shell, 'ASCII')) &&
35+
($shell == trim($shell)) &&
36+
(!empty($shell))
37+
);
38+
}
39+
3140
#[DataProvider("getShells")]
3241
public function testSetLoginShellCustom(string $shell): void
3342
{
3443
global $USER;
35-
// FIXME add check to avoid warning from ldap_modify
36-
if (
37-
(!mb_check_encoding($shell, 'ASCII')) ||
38-
($shell != trim($shell)) ||
39-
(empty($shell))
40-
) {
41-
$this->expectException("Exception");
44+
if (!$this->isShellValid($shell)) {
45+
$this->expectException(Exception::class);
4246
}
43-
// FIXME shell is not validated
4447
post(
4548
__DIR__ . "/../../webroot/panel/account.php",
4649
["form_type" => "loginshell", "shellSelect" => "Custom", "shell" => $shell]
@@ -52,11 +55,9 @@ public function testSetLoginShellCustom(string $shell): void
5255
public function testSetLoginShellSelect(string $shell): void
5356
{
5457
global $USER;
55-
// FIXME add check to avoid warning from ldap_modify
56-
if (!mb_check_encoding($shell, 'ASCII')) {
58+
if (!$this->isShellValid($shell)) {
5759
$this->expectException("Exception");
5860
}
59-
// FIXME shell is not validated
6061
post(
6162
__DIR__ . "/../../webroot/panel/account.php",
6263
["form_type" => "loginshell", "shellSelect" => $shell]

0 commit comments

Comments
 (0)