| 12345678910111213141516171819 |
- <?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");
- }
- }
|