Move perms2str to ACLFormatter::aclToString()

- including new tests
This commit is contained in:
Philipp Holzer 2019-10-23 00:54:34 +02:00
parent f65f7f11c3
commit 5843a80b6c
No known key found for this signature in database
GPG key ID: D8365C3D36B77D90
7 changed files with 122 additions and 62 deletions

View file

@ -161,4 +161,40 @@ class ACLFormaterTest extends TestCase
$text="<1><><3>";
$this->assertEquals(array('1', '3'), $aclFormatter->expand($text));
}
public function dataAclToString()
{
return [
'empty' => [
'input' => '',
'assert' => '',
],
'string' => [
'input' => '1,2,3,4',
'assert' => '<1><2><3><4>',
],
'array' => [
'input' => [1, 2, 3, 4],
'assert' => '<1><2><3><4>',
],
'invalid' => [
'input' => [1, 'a', 3, 4],
'assert' => '<1><3><4>',
],
'invalidString' => [
'input' => 'a,bsd23,4',
'assert' => '<4>',
],
];
}
/**
* @dataProvider dataAclToString
*/
public function testAclToString($input, string $assert)
{
$aclFormatter = new ACLFormatter();
$this->assertEquals($assert, $aclFormatter->aclToString($input));
}
}