parser = new OkRuUrlParser(); } #[DataProvider('urlShapes')] public function test_parses_canonical_and_embed_urls(string $url, string $expectedId): void { $ref = $this->parser->parse($url); self::assertSame(Platform::OK, $ref->platform); self::assertSame($expectedId, $ref->id); } public function test_parses_legacy_deep_link_query(): void { $ref = $this->parser->parse('https://ok.ru/dk?st.cmd=movieLayer&st.mvId=863789452017&tkn=3648'); self::assertSame('863789452017', $ref->id); } public function test_parses_id_with_segment_suffix(): void { $ref = $this->parser->parse('https://ok.ru/video/63567059965189-0'); self::assertSame('63567059965189-0', $ref->id); } public static function urlShapes(): array { return [ 'video' => ['https://ok.ru/video/15019292494547', '15019292494547'], 'videoembed' => ['https://ok.ru/videoembed/2932705602075', '2932705602075'], 'live' => ['https://ok.ru/live/484531969818', '484531969818'], 'moviePlayer API' => ['https://ok.ru/web-api/video/moviePlayer/20079905452', '20079905452'], 'mobile' => ['https://m.ok.ru/video/2361249957145', '2361249957145'], ]; } }