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); } /** @test **/ public function remoteMention() { $expected = [ "hashtags" => [ "dansup", ], "urls" => [], "mentions" => [ "@dansup@mstdn.io", "test", ], "replyto" => null, "hashtags_with_indices" => [ [ "hashtag" => "dansup", "indices" => [ 0, 7, ], ], ], "urls_with_indices" => [], "mentions_with_indices" => [ [ "screen_name" => "@dansup@mstdn.io", "indices" => [ 8, 24, ], ], [ "screen_name" => "test", "indices" => [ 25, 30, ], ], ], ]; $actual = Extractor::create()->extract('#dansup @dansup@mstdn.io @test'); $this->assertEquals($actual, $expected); } }