File tree Expand file tree Collapse file tree 5 files changed +31
-4
lines changed Expand file tree Collapse file tree 5 files changed +31
-4
lines changed Original file line number Diff line number Diff line change 1
1
/vendor
2
2
composer.lock
3
3
/phpunit /
4
+ .idea /
Original file line number Diff line number Diff line change @@ -11,4 +11,4 @@ before_script:
11
11
- composer install
12
12
script :
13
13
- vendor/bin/php-cs-fixer fix --level=psr2 --dry-run src
14
- - vendor/bin/php-cs-fixer fix --level=psr2 --dry-run tests
14
+ - vendor/bin/php-cs-fixer fix --level=psr2 --dry-run tests/VerbalExpressionsTest.php
Original file line number Diff line number Diff line change 4
4
"type" : " project" ,
5
5
"description" : " PHP Regular expressions made easy" ,
6
6
"require" : {
7
- "php" : " >=5.3" ,
8
- "fabpot/php-cs-fixer" : " ^1.11"
7
+ "php" : " >=5.3"
9
8
},
10
9
"require-dev" : {
11
- "phpunit/phpunit" : " * >=4"
10
+ "phpunit/phpunit" : " * >=4" ,
11
+ "fabpot/php-cs-fixer" : " ^1.11"
12
12
},
13
13
"suggest" : {
14
14
"fabpot/php-cs-fixer" : " PHP CS Fixer (testing for PSR-2 compliance)"
Original file line number Diff line number Diff line change @@ -247,6 +247,19 @@ public function word()
247
247
return $ this ->add ('\\w+ ' );
248
248
}
249
249
250
+ /**
251
+ * Digit
252
+ *
253
+ * Match any digit
254
+ *
255
+ * @access public
256
+ * @return VerbalExpressions
257
+ */
258
+ public function digit ()
259
+ {
260
+ return $ this ->add ('\\d ' );
261
+ }
262
+
250
263
/**
251
264
* List Chars
252
265
*
Original file line number Diff line number Diff line change @@ -254,6 +254,19 @@ public function testWord()
254
254
$ this ->assertFalse ($ regex ->test ('a!b ' ));
255
255
}
256
256
257
+
258
+ public function testDigit ()
259
+ {
260
+ $ regex = new VerbalExpressions ();
261
+ $ regex ->digit ();
262
+
263
+ $ this ->assertTrue ($ regex ->test ('0123456789 ' ));
264
+
265
+ foreach (str_split ('ABCDEFGHIJKLMNOPQRSTUVWXYZ_-@,./%* ' ) as $ char ) {
266
+ $ this ->assertFalse ($ regex ->test ($ char ), 'Should not match digit ( ' .$ char .') ' );
267
+ }
268
+ }
269
+
257
270
public function testAny ()
258
271
{
259
272
$ regex = new VerbalExpressions ();
You can’t perform that action at this time.
0 commit comments