urlFinder = Bootstrap::getObjectManager()->create(UrlFinderInterface::class); } /** * @dataProvider findOneDataProvider * @param string $requestPath * @param string $targetPath * @param int $redirectType */ public function testFindOneByData(string $requestPath, string $targetPath, int $redirectType) { $data = [ UrlRewrite::REQUEST_PATH => $requestPath, ]; $urlRewrite = $this->urlFinder->findOneByData($data); $this->assertEquals($targetPath, $urlRewrite->getTargetPath()); $this->assertEquals($redirectType, $urlRewrite->getRedirectType()); } /** * @return array */ public function findOneDataProvider(): array { return [ ['string', 'test_page1', 0], ['string/', 'string', 301], ['string_permanent', 'test_page1', 301], ['string_permanent/', 'test_page1', 301], ['string_temporary', 'test_page1', 302], ['string_temporary/', 'test_page1', 302], ['строка', 'test_page1', 0], ['строка/', 'строка', 301], [urlencode('строка'), 'test_page2', 0], [urlencode('строка') . '/', urlencode('строка'), 301], ['другая_строка', 'test_page1', 302], ['другая_строка/', 'test_page1', 302], [urlencode('другая_строка'), 'test_page1', 302], [urlencode('другая_строка') . '/', 'test_page1', 302], ['السلسلة', 'test_page1', 0], [urlencode('السلسلة'), 'test_page1', 0], ]; } }