namespace Friendica\Test\src\Util;
+use Error;
use Friendica\Model\Group;
use Friendica\Util\ACLFormatter;
use PHPUnit\Framework\TestCase;
$text="<1><><3>";
$this->assertEquals(array('1', '3'), $aclFormatter->expand($text));
}
+
+ /**
+ * Test expected exception in case of wrong typehint
+ *
+ * @expectedException Error
+ */
+ public function testExpandNull()
+ {
+ $aclFormatter = new ACLFormatter();
+
+ $aclFormatter->expand(null);
+ }
+
+ 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->toString($input));
+ }
}