- 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"));
- }
-
- /**
- * test get_tags
- */
- public function testGetTags() {
- $text="hi @Mike, I'm just writing #test_cases, "
- ." so @somebody@friendica.com may change #things. Of course I "
- ."look for a lot of #pitfalls, like #tags at the end of a sentence "
- ."@comment. I hope noone forgets about @fullstops.because that might"
- ." break #things. @Mike@campino@friendica.eu is also #nice, isn't it? "
- ."Now, add a @first_last tag. ";
- //check whether this are all variants (no, auto-stuff is missing).
-
- $tags=get_tags($text);
-
- $this->assertEquals("@Mike", $tags[0]);
- $this->assertEquals("#test_cases", $tags[1]);
- $this->assertEquals("@somebody@friendica.com", $tags[2]);
- $this->assertEquals("#things", $tags[3]);
- $this->assertEquals("#pitfalls", $tags[4]);
- $this->assertEquals("#tags", $tags[5]);
- $this->assertEquals("@comment", $tags[6]);
- $this->assertEquals("@fullstops", $tags[7]);
- $this->assertEquals("#things", $tags[8]);
- $this->assertEquals("@Mike", $tags[9]);
- $this->assertEquals("@campino@friendica.eu", $tags[10]);
- $this->assertEquals("#nice", $tags[11]);
- $this->assertEquals("@first_last", $tags[12]);
- }
-
- public function testGetTagsEmpty() {
- $tags=get_tags("");
- $this->assertEquals(0, count($tags));
- }
-//function qp, quick and dirty??
-//get_mentions
-//get_contact_block, bis Zeile 538