mirror of
https://github.com/friendica/friendica
synced 2025-04-30 17:04:23 +02:00
Move perms2str to ACLFormatter::aclToString()
- including new tests
This commit is contained in:
parent
f65f7f11c3
commit
5843a80b6c
7 changed files with 122 additions and 62 deletions
|
@ -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));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue