14
14
use Magento \TestFramework \ObjectManager ;
15
15
use Magento \UrlRewrite \Model \ResourceModel \UrlRewriteCollection ;
16
16
use Magento \UrlRewrite \Model \ResourceModel \UrlRewriteCollectionFactory ;
17
- use Magento \UrlRewrite \Model \UrlFinderInterface ;
18
17
use Magento \UrlRewrite \Model \UrlRewrite as UrlRewriteItem ;
19
18
use Magento \UrlRewrite \Service \V1 \Data \UrlRewrite ;
20
19
use PHPUnit \Framework \TestCase ;
@@ -29,11 +28,6 @@ class FindByUrlRewriteTest extends TestCase
29
28
*/
30
29
private $ objectManger ;
31
30
32
- /**
33
- * @var UrlFinderInterface
34
- */
35
- private $ urlFinder ;
36
-
37
31
/**
38
32
* @var ProductResource
39
33
*/
@@ -55,7 +49,6 @@ class FindByUrlRewriteTest extends TestCase
55
49
protected function setUp ()
56
50
{
57
51
$ this ->objectManger = Bootstrap::getObjectManager ();
58
- $ this ->urlFinder = $ this ->objectManger ->get (UrlFinderInterface::class);
59
52
$ this ->productResource = $ this ->objectManger ->get (ProductResource::class);
60
53
$ this ->productRepository = $ this ->objectManger ->get (ProductRepositoryInterface::class);
61
54
$ this ->urlRewriteCollectionFactory = $ this ->objectManger ->get (UrlRewriteCollectionFactory::class);
@@ -251,13 +244,8 @@ private function getUrlRewritesCollectionByProductIds(
251
244
private function checkConfigurableUrlRewriteWasCreated (): void
252
245
{
253
246
$ configurableProduct = $ this ->productRepository ->get ('Configurable product ' );
254
- $ configurableUrlRewrite = $ this ->urlFinder ->findOneByData (
255
- [
256
- UrlRewrite::ENTITY_TYPE => 'product ' ,
257
- UrlRewrite::ENTITY_ID => $ configurableProduct ->getId (),
258
- ]
259
- );
260
- $ this ->assertNotNull ($ configurableUrlRewrite );
247
+ $ configurableUrlRewrite = $ this ->getUrlRewritesCollectionByProductIds ([$ configurableProduct ->getId ()])
248
+ ->getFirstItem ();
261
249
$ this ->assertEquals (
262
250
$ configurableUrlRewrite ->getTargetPath (),
263
251
"catalog/product/view/id/ {$ configurableProduct ->getId ()}"
0 commit comments