ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
Sabre\DAV\StringUtilTest Class Reference
+ Inheritance diagram for Sabre\DAV\StringUtilTest:
+ Collaboration diagram for Sabre\DAV\StringUtilTest:

Public Member Functions

 testTextMatch ($haystack, $needle, $collation, $matchType, $result)
 
 dataset ()
 
 testBadCollation ()
 Sabre More...
 
 testBadMatchType ()
 Sabre More...
 
 testEnsureUTF8_ascii ()
 
 testEnsureUTF8_latin1 ()
 
 testEnsureUTF8_utf8 ()
 

Detailed Description

Definition at line 5 of file StringUtilTest.php.

Member Function Documentation

◆ dataset()

Sabre\DAV\StringUtilTest::dataset ( )

Definition at line 23 of file StringUtilTest.php.

23  {
24 
25  return [
26  ['FOOBAR', 'FOO', 'i;octet', 'contains', true],
27  ['FOOBAR', 'foo', 'i;octet', 'contains', false],
28  ['FÖÖBAR', 'FÖÖ', 'i;octet', 'contains', true],
29  ['FÖÖBAR', 'föö', 'i;octet', 'contains', false],
30  ['FOOBAR', 'FOOBAR', 'i;octet', 'equals', true],
31  ['FOOBAR', 'fooBAR', 'i;octet', 'equals', false],
32  ['FOOBAR', 'FOO', 'i;octet', 'starts-with', true],
33  ['FOOBAR', 'foo', 'i;octet', 'starts-with', false],
34  ['FOOBAR', 'BAR', 'i;octet', 'starts-with', false],
35  ['FOOBAR', 'bar', 'i;octet', 'starts-with', false],
36  ['FOOBAR', 'FOO', 'i;octet', 'ends-with', false],
37  ['FOOBAR', 'foo', 'i;octet', 'ends-with', false],
38  ['FOOBAR', 'BAR', 'i;octet', 'ends-with', true],
39  ['FOOBAR', 'bar', 'i;octet', 'ends-with', false],
40 
41  ['FOOBAR', 'FOO', 'i;ascii-casemap', 'contains', true],
42  ['FOOBAR', 'foo', 'i;ascii-casemap', 'contains', true],
43  ['FÖÖBAR', 'FÖÖ', 'i;ascii-casemap', 'contains', true],
44  ['FÖÖBAR', 'föö', 'i;ascii-casemap', 'contains', false],
45  ['FOOBAR', 'FOOBAR', 'i;ascii-casemap', 'equals', true],
46  ['FOOBAR', 'fooBAR', 'i;ascii-casemap', 'equals', true],
47  ['FOOBAR', 'FOO', 'i;ascii-casemap', 'starts-with', true],
48  ['FOOBAR', 'foo', 'i;ascii-casemap', 'starts-with', true],
49  ['FOOBAR', 'BAR', 'i;ascii-casemap', 'starts-with', false],
50  ['FOOBAR', 'bar', 'i;ascii-casemap', 'starts-with', false],
51  ['FOOBAR', 'FOO', 'i;ascii-casemap', 'ends-with', false],
52  ['FOOBAR', 'foo', 'i;ascii-casemap', 'ends-with', false],
53  ['FOOBAR', 'BAR', 'i;ascii-casemap', 'ends-with', true],
54  ['FOOBAR', 'bar', 'i;ascii-casemap', 'ends-with', true],
55 
56  ['FOOBAR', 'FOO', 'i;unicode-casemap', 'contains', true],
57  ['FOOBAR', 'foo', 'i;unicode-casemap', 'contains', true],
58  ['FÖÖBAR', 'FÖÖ', 'i;unicode-casemap', 'contains', true],
59  ['FÖÖBAR', 'föö', 'i;unicode-casemap', 'contains', true],
60  ['FOOBAR', 'FOOBAR', 'i;unicode-casemap', 'equals', true],
61  ['FOOBAR', 'fooBAR', 'i;unicode-casemap', 'equals', true],
62  ['FOOBAR', 'FOO', 'i;unicode-casemap', 'starts-with', true],
63  ['FOOBAR', 'foo', 'i;unicode-casemap', 'starts-with', true],
64  ['FOOBAR', 'BAR', 'i;unicode-casemap', 'starts-with', false],
65  ['FOOBAR', 'bar', 'i;unicode-casemap', 'starts-with', false],
66  ['FOOBAR', 'FOO', 'i;unicode-casemap', 'ends-with', false],
67  ['FOOBAR', 'foo', 'i;unicode-casemap', 'ends-with', false],
68  ['FOOBAR', 'BAR', 'i;unicode-casemap', 'ends-with', true],
69  ['FOOBAR', 'bar', 'i;unicode-casemap', 'ends-with', true],
70  ];
71 
72  }

◆ testBadCollation()

Sabre\DAV\StringUtilTest::testBadCollation ( )

Sabre

Definition at line 77 of file StringUtilTest.php.

References Sabre\DAV\StringUtil\textMatch().

77  {
78 
79  StringUtil::textMatch('foobar', 'foo', 'blabla', 'contains');
80 
81  }
static textMatch($haystack, $needle, $collation, $matchType='contains')
Checks if a needle occurs in a haystack ;)
Definition: StringUtil.php:27
+ Here is the call graph for this function:

◆ testBadMatchType()

Sabre\DAV\StringUtilTest::testBadMatchType ( )

Sabre

Definition at line 87 of file StringUtilTest.php.

References Sabre\DAV\StringUtil\textMatch().

87  {
88 
89  StringUtil::textMatch('foobar', 'foo', 'i;octet', 'booh');
90 
91  }
static textMatch($haystack, $needle, $collation, $matchType='contains')
Checks if a needle occurs in a haystack ;)
Definition: StringUtil.php:27
+ Here is the call graph for this function:

◆ testEnsureUTF8_ascii()

Sabre\DAV\StringUtilTest::testEnsureUTF8_ascii ( )

Definition at line 93 of file StringUtilTest.php.

References Sabre\DAV\StringUtil\ensureUTF8().

93  {
94 
95  $inputString = "harkema";
96  $outputString = "harkema";
97 
98  $this->assertEquals(
99  $outputString,
100  StringUtil::ensureUTF8($inputString)
101  );
102 
103  }
static ensureUTF8($input)
This method takes an input string, checks if it's not valid UTF-8 and attempts to convert it to UTF-8...
Definition: StringUtil.php:79
+ Here is the call graph for this function:

◆ testEnsureUTF8_latin1()

Sabre\DAV\StringUtilTest::testEnsureUTF8_latin1 ( )

Definition at line 105 of file StringUtilTest.php.

References Sabre\DAV\StringUtil\ensureUTF8().

105  {
106 
107  $inputString = "m\xfcnster";
108  $outputString = "münster";
109 
110  $this->assertEquals(
111  $outputString,
112  StringUtil::ensureUTF8($inputString)
113  );
114 
115  }
static ensureUTF8($input)
This method takes an input string, checks if it's not valid UTF-8 and attempts to convert it to UTF-8...
Definition: StringUtil.php:79
+ Here is the call graph for this function:

◆ testEnsureUTF8_utf8()

Sabre\DAV\StringUtilTest::testEnsureUTF8_utf8 ( )

Definition at line 117 of file StringUtilTest.php.

References Sabre\DAV\StringUtil\ensureUTF8().

117  {
118 
119  $inputString = "m\xc3\xbcnster";
120  $outputString = "münster";
121 
122  $this->assertEquals(
123  $outputString,
124  StringUtil::ensureUTF8($inputString)
125  );
126 
127  }
static ensureUTF8($input)
This method takes an input string, checks if it's not valid UTF-8 and attempts to convert it to UTF-8...
Definition: StringUtil.php:79
+ Here is the call graph for this function:

◆ testTextMatch()

Sabre\DAV\StringUtilTest::testTextMatch (   $haystack,
  $needle,
  $collation,
  $matchType,
  $result 
)
Parameters
string$haystack
string$needle
string$collation
string$matchType
string$result
Exceptions
Exception

Definition at line 17 of file StringUtilTest.php.

References $result, and Sabre\DAV\StringUtil\textMatch().

17  {
18 
19  $this->assertEquals($result, StringUtil::textMatch($haystack, $needle, $collation, $matchType));
20 
21  }
$result
static textMatch($haystack, $needle, $collation, $matchType='contains')
Checks if a needle occurs in a haystack ;)
Definition: StringUtil.php:27
+ Here is the call graph for this function:

The documentation for this class was generated from the following file: