- /**
- * test expand_acl
- */
- public function testExpandAclNormal() {
- $text="<1><2><3>";
- $this->assertEquals(array(1, 2, 3), expand_acl($text));
- }
-
- public function testExpandAclBigNumber() {
- $text="<1><279012><15>";
- $this->assertEquals(array(1, 279012, 15), expand_acl($text));
- }
-
- public function testExpandAclString() {
- $text="<1><279012><tt>"; //maybe that's invalid
- $this->assertEquals(array(1, 279012, 'tt'), expand_acl($text));
- }
-
- public function testExpandAclSpace() {
- $text="<1><279 012><32>"; //maybe that's invalid
- $this->assertEquals(array(1, "279 012", "32"), expand_acl($text));
- }
-
- public function testExpandAclEmpty() {
- $text=""; //maybe that's invalid
- $this->assertEquals(array(), expand_acl($text));
- }
-
- public function testExpandAclNoBrackets() {
- $text="According to documentation, that's invalid. "; //should be invalid
- $this->assertEquals(array(), expand_acl($text));
- }
-
- public function testExpandAclJustOneBracket1() {
- $text="<Another invalid string"; //should be invalid
- $this->assertEquals(array(), expand_acl($text));
- }
-
- public function testExpandAclJustOneBracket2() {
- $text="Another invalid> string"; //should be invalid
- $this->assertEquals(array(), expand_acl($text));
- }
-
- public function testExpandAclCloseOnly() {
- $text="Another> invalid> string>"; //should be invalid
- $this->assertEquals(array(), expand_acl($text));
- }
-
- public function testExpandAclOpenOnly() {
- $text="<Another< invalid string<"; //should be invalid
- $this->assertEquals(array(), expand_acl($text));
- }
-
- public function testExpandAclNoMatching1() {
- $text="<Another<> invalid <string>"; //should be invalid
- $this->assertEquals(array(), expand_acl($text));
- }
-
- public function testExpandAclNoMatching2() {
- $text="<1>2><3>";
- $this->assertEquals(array(), expand_acl($text));
- }
-
- /**
- * test attribute contains
- */
- public function testAttributeContains1() {
- $testAttr="class1 notclass2 class3";
- $this->assertTrue(attribute_contains($testAttr, "class3"));
- $this->assertFalse(attribute_contains($testAttr, "class2"));
- }
-
- /**
- * test attribute contains
- */
- public function testAttributeContains2() {
- $testAttr="class1 not-class2 class3";
- $this->assertTrue(attribute_contains($testAttr, "class3"));
- $this->assertFalse(attribute_contains($testAttr, "class2"));
- }
-
- public function testAttributeContainsEmpty() {
- $testAttr="";
- $this->assertFalse(attribute_contains($testAttr, "class2"));
- }
-
- public function testAttributeContainsSpecialChars() {
- $testAttr="--... %\$รค() /(=?}";
- $this->assertFalse(attribute_contains($testAttr, "class2"));
- }
-