diff --git a/tests/Unit/Lexer/StatusLexerTest.php b/tests/Unit/Lexer/StatusLexerTest.php new file mode 100644 index 000000000..fbfa15cb7 --- /dev/null +++ b/tests/Unit/Lexer/StatusLexerTest.php @@ -0,0 +1,66 @@ +status = "@pixelfed hi, really like the website! #píxelfed"; + $this->entities = Extractor::create()->extract($this->status); + $this->autolink = Autolink::create()->autolink($this->status); + } + + public function testLexerExtractor() + { + $expected = [ + "hashtags" => [ + "píxelfed", + ], + "urls" => [], + "mentions" => [ + "pixelfed", + ], + "replyto" => "pixelfed", + "hashtags_with_indices" => [ + [ + "hashtag" => "píxelfed", + "indices" => [ + 39, + 48, + ], + ], + ], + "urls_with_indices" => [], + "mentions_with_indices" => [ + [ + "screen_name" => "pixelfed", + "indices" => [ + 0, + 9, + ], + ] + ] + ]; + + $this->assertEquals($this->entities, $expected); + } + + public function testAutolink() + { + $expected = '@pixelfed hi, really like the website! #píxelfed'; + + $this->assertEquals($this->autolink, $expected); + } +}