1 | <?php |
||
11 | final class StringsTest extends TestCase |
||
12 | { |
||
13 | /** |
||
14 | * Verify basic use of filter |
||
15 | * |
||
16 | * @test |
||
17 | * @covers ::filter |
||
18 | * @dataProvider filterData |
||
19 | * |
||
20 | * @param mixed $input The input. |
||
21 | * @param mixed $expected The expected value(s). |
||
22 | * |
||
23 | * @return void |
||
24 | * @throws Exception |
||
25 | */ |
||
26 | public function filter($input, $expected) |
||
30 | |||
31 | /** |
||
32 | * Data provider for basic filter tests |
||
33 | * |
||
34 | * @return array |
||
35 | */ |
||
36 | public function filterData() |
||
46 | |||
47 | /** |
||
48 | * @test |
||
49 | * @covers ::filter |
||
50 | */ |
||
51 | public function filterNullPass() |
||
55 | |||
56 | /** |
||
57 | * @test |
||
58 | * @expectedException \TraderInteractive\Filter\Exception |
||
59 | * @expectedExceptionMessage Value 'NULL' is not a string |
||
60 | * @covers ::filter |
||
61 | */ |
||
62 | public function filterNullFail() |
||
66 | |||
67 | /** |
||
68 | * @test |
||
69 | * @covers ::filter |
||
70 | */ |
||
71 | public function filterMinLengthPass() |
||
75 | |||
76 | /** |
||
77 | * @test |
||
78 | * @expectedException \TraderInteractive\Filter\Exception |
||
79 | * @covers ::filter |
||
80 | */ |
||
81 | public function filterMinLengthFail() |
||
85 | |||
86 | /** |
||
87 | * @test |
||
88 | * @covers ::filter |
||
89 | */ |
||
90 | public function filterMaxLengthPass() |
||
94 | |||
95 | /** |
||
96 | * @test |
||
97 | * @expectedException \TraderInteractive\Filter\Exception |
||
98 | * @expectedExceptionMessage Value 'a' with length '1' is less than '0' or greater than '0' |
||
99 | * @covers ::filter |
||
100 | */ |
||
101 | public function filterMaxLengthFail() |
||
105 | |||
106 | /** |
||
107 | * @test |
||
108 | * @expectedException InvalidArgumentException |
||
109 | * @expectedExceptionMessage $minLength was not a positive integer value |
||
110 | * @covers ::filter |
||
111 | */ |
||
112 | public function filterMinLengthNotInteger() |
||
116 | |||
117 | /** |
||
118 | * @test |
||
119 | * @expectedException InvalidArgumentException |
||
120 | * @expectedExceptionMessage $maxLength was not a positive integer value |
||
121 | * @covers ::filter |
||
122 | */ |
||
123 | public function filterMaxLengthNotInteger() |
||
127 | |||
128 | /** |
||
129 | * @test |
||
130 | * @expectedException InvalidArgumentException |
||
131 | * @expectedExceptionMessage $minLength was not a positive integer value |
||
132 | * @covers ::filter |
||
133 | */ |
||
134 | public function filterMinLengthNegative() |
||
138 | |||
139 | /** |
||
140 | * @test |
||
141 | * @expectedException InvalidArgumentException |
||
142 | * @expectedExceptionMessage $maxLength was not a positive integer value |
||
143 | * @covers ::filter |
||
144 | */ |
||
145 | public function filterMaxLengthNegative() |
||
149 | |||
150 | /** |
||
151 | * Verifies basic explode functionality. |
||
152 | * |
||
153 | * @test |
||
154 | * @covers ::explode |
||
155 | */ |
||
156 | public function explode() |
||
160 | |||
161 | /** |
||
162 | * Verifies explode with a custom delimiter. |
||
163 | * |
||
164 | * @test |
||
165 | * @covers ::explode |
||
166 | */ |
||
167 | public function explodeCustomDelimiter() |
||
171 | |||
172 | /** |
||
173 | * Verifies explode filter with an empty delimiter. |
||
174 | * |
||
175 | * @test |
||
176 | * @expectedException \InvalidArgumentException |
||
177 | * @expectedExceptionMessage Delimiter '''' is not a non-empty string |
||
178 | * @covers ::explode |
||
179 | */ |
||
180 | public function explodeEmptyDelimiter() |
||
184 | } |
||
185 |