]> git.mxchange.org Git - friendica.git/blob - tests/contains_attribute_test.php
Bugfix: The bbcode conversion of the profile was inconsistent
[friendica.git] / tests / contains_attribute_test.php
1 <?php
2 /**\r
3  * this test tests the contains_attribute function\r
4  *\r
5  * @package test.util\r
6  */\r
7 \r
8 /** required, it is the file under test */\r
9 require_once('include/text.php');\r
10 \r
11 /**\r
12  * TestCase for the contains_attribute function\r
13  *\r
14  * @author Alexander Kampmann\r
15  * @package test.util\r
16  */\r
17 class ContainsAttributeTest extends PHPUnit_Framework_TestCase {
18         /**\r
19          * test attribute contains\r
20          */\r
21         public function testAttributeContains1() {\r
22                 $testAttr="class1 notclass2 class3";\r
23                 $this->assertTrue(attribute_contains($testAttr, "class3"));\r
24                 $this->assertFalse(attribute_contains($testAttr, "class2"));\r
25         }\r
26         \r
27         /**\r
28          * test attribute contains\r
29          */\r
30         public function testAttributeContains2() {\r
31                 $testAttr="class1 not-class2 class3";\r
32                 $this->assertTrue(attribute_contains($testAttr, "class3"));\r
33                 $this->assertFalse(attribute_contains($testAttr, "class2"));\r
34         }\r
35         
36         /**
37          * test with empty input
38          */\r
39         public function testAttributeContainsEmpty() {\r
40                 $testAttr="";\r
41                 $this->assertFalse(attribute_contains($testAttr, "class2"));\r
42         }\r
43         
44         /**
45          * test input with special chars
46          */\r
47         public function testAttributeContainsSpecialChars() {\r
48                 $testAttr="--... %\$รค() /(=?}";\r
49                 $this->assertFalse(attribute_contains($testAttr, "class2"));\r
50         }
51 }