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