/
githubmirror
/
magento2
Обзор
Документация
Войти
/
githubmirror
/
magento2
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
2.4-develop
dev/tests/integration/testsuite/Magento/UrlRewrite/Model/UrlFinderInterfaceTest.php
72 строки
2 KB
Raj Mohan R
AC-16236::Upgrade Core Test Framework to PHPUnit 12 and Migrate from PHPUnit 10
11 фев 2026, 13:51
11 фев 2026, 13:51
152ed41
Код
Авторство
О чём код?
<?php /** * Copyright 2019 Adobe * All Rights Reserved. */ declare(strict_types=1); namespace Magento\UrlRewrite\Model; use Magento\TestFramework\Helper\Bootstrap; use Magento\UrlRewrite\Service\V1\Data\UrlRewrite; use PHPUnit\Framework\Attributes\DataProvider; /** * @magentoDataFixture Magento/UrlRewrite/_files/url_rewrites.php */ class UrlFinderInterfaceTest extends \PHPUnit\Framework\TestCase { /** * @var UrlFinderInterface */ private $urlFinder; /** * @inheritdoc */ protected function setUp(): void { $this->urlFinder = Bootstrap::getObjectManager()->create(UrlFinderInterface::class); } /** * @param string $requestPath * @param string $targetPath * @param int $redirectType */ #[DataProvider('findOneDataProvider')] 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 static 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], ]; } }