|
|
@@ -0,0 +1,19 @@
|
|
|
+<?php
|
|
|
+use PHPUnit\Framework\TestCase;
|
|
|
+class HomeTest extends TestCase
|
|
|
+{
|
|
|
+ public function testRegexMention()
|
|
|
+ {
|
|
|
+ $text = 'Salut @nathan';
|
|
|
+ $mentions = array();
|
|
|
+ preg_match_all("~@([a-zA-Z0-9_]*)~", $text, $mentions);
|
|
|
+ self::assertEquals($mentions[0][0], "@nathan");
|
|
|
+ }
|
|
|
+ public function testRegexHashtag()
|
|
|
+ {
|
|
|
+ $text = 'Salut #nathan';
|
|
|
+ $mentions = array();
|
|
|
+ preg_match_all("~#([a-zA-Z0-9_]*)~", $text, $mentions);
|
|
|
+ self::assertEquals($mentions[0][0], "#nathan");
|
|
|
+ }
|
|
|
+}
|