@@ -14,6 +14,12 @@ public function testShouldPassWhenValidUrlGiven($url)
14
14
$ this ->buildUrlPattern ($ regex );
15
15
16
16
$ this ->assertTrue ($ regex ->test ($ url ));
17
+
18
+
19
+ $ regex = new VerbalExpressions ();
20
+ $ this ->buildUrlPatternAliased ($ regex );
21
+
22
+ $ this ->assertTrue ($ regex ->test ($ url ));
17
23
}
18
24
19
25
public static function provideValidUrls ()
@@ -62,6 +68,17 @@ protected function buildUrlPattern(VerbalExpressions $regex)
62
68
->endOfLine ();
63
69
}
64
70
71
+ protected function buildUrlPatternAliased (VerbalExpressions $ regex )
72
+ {
73
+ return $ regex ->startOfLine ()
74
+ ->find ("http " )
75
+ ->maybe ("s " )
76
+ ->find (":// " )
77
+ ->maybe ("www. " )
78
+ ->anythingBut (" " )
79
+ ->endOfLine ();
80
+ }
81
+
65
82
public function testThenAfterStartOfLine ()
66
83
{
67
84
$ regex = new VerbalExpressions ();
@@ -165,6 +182,19 @@ public function testSomethingBut()
165
182
$ this ->assertFalse ($ regex ->test ('' ));
166
183
}
167
184
185
+ public function testBr ()
186
+ {
187
+ $ regex = new VerbalExpressions ();
188
+ $ regex ->startOfLine ()
189
+ ->something ()
190
+ ->br ()
191
+ ->something ()
192
+ ->endOfLine ();
193
+
194
+ $ this ->assertTrue ($ regex ->test ("foo \nbar " ));
195
+ $ this ->assertFalse ($ regex ->test ("foo bar " ));
196
+ }
197
+
168
198
public function testLineBreak ()
169
199
{
170
200
$ regex = new VerbalExpressions ();
@@ -206,6 +236,21 @@ public function testWord()
206
236
$ this ->assertFalse ($ regex ->test ('a!b ' ));
207
237
}
208
238
239
+ public function testAny ()
240
+ {
241
+ $ regex = new VerbalExpressions ();
242
+ $ regex ->startOfLine ()
243
+ ->any ('a1M ' )
244
+ ->endOfLine ();
245
+
246
+ $ this ->assertTrue ($ regex ->test ('a ' ));
247
+ $ this ->assertTrue ($ regex ->test ('1 ' ));
248
+ $ this ->assertTrue ($ regex ->test ('M ' ));
249
+ $ this ->assertFalse ($ regex ->test ('b ' ));
250
+ $ this ->assertFalse ($ regex ->test ('' ));
251
+ $ this ->assertFalse ($ regex ->test (' ' ));
252
+ }
253
+
209
254
public function testAnyOf ()
210
255
{
211
256
$ regex = new VerbalExpressions ();
0 commit comments