From 127990e95fd7f048fd108e95b729b2abee7cbe44 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Wed, 28 Nov 2018 22:47:39 -0700 Subject: [PATCH] Add Status Lexer Test --- tests/Unit/Lexer/StatusLexerTest.php | 66 ++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 tests/Unit/Lexer/StatusLexerTest.php 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); + } +}