8
8
9
9
use Magento \Catalog \Model \ProductRepository ;
10
10
use Magento \Framework \App \Bootstrap ;
11
- use Magento \Framework \App \Config \ScopeConfigInterface ;
12
11
use Magento \Framework \App \Filesystem \DirectoryList ;
13
12
use Magento \Framework \UrlInterface ;
14
13
use Magento \Store \Api \StoreRepositoryInterface ;
@@ -201,7 +200,7 @@ public function testGetBaseUrlInPub()
201
200
*/
202
201
public function testGetBaseUrlForCustomEntryPoint ($ type , $ useCustomEntryPoint , $ useStoreCode , $ expected )
203
202
{
204
- /* config operations require store to be loaded */
203
+ /* config operations require store to be loaded */
205
204
$ this ->model ->load ('default ' );
206
205
\Magento \TestFramework \Helper \Bootstrap::getObjectManager ()
207
206
->get (\Magento \Framework \App \Config \MutableScopeConfigInterface::class)
@@ -213,6 +212,10 @@ public function testGetBaseUrlForCustomEntryPoint($type, $useCustomEntryPoint, $
213
212
214
213
// emulate custom entry point
215
214
$ _SERVER ['SCRIPT_FILENAME ' ] = 'custom_entry.php ' ;
215
+ $ request = \Magento \TestFramework \Helper \Bootstrap::getObjectManager ()
216
+ ->get (\Magento \Framework \App \RequestInterface::class);
217
+ $ request ->setServer (new Parameters ($ _SERVER ));
218
+
216
219
if ($ useCustomEntryPoint ) {
217
220
$ property = new \ReflectionProperty ($ this ->model , '_isCustomEntryPoint ' );
218
221
$ property ->setAccessible (true );
@@ -298,11 +301,11 @@ public function testGetCurrentUrl()
298
301
$ url = $ product ->getUrlInStore ();
299
302
300
303
$ this ->assertEquals (
301
- $ secondStore ->getBaseUrl (). 'catalog/product/view/id/1/s/simple-product/ ' ,
304
+ $ secondStore ->getBaseUrl () . 'catalog/product/view/id/1/s/simple-product/ ' ,
302
305
$ url
303
306
);
304
307
$ this ->assertEquals (
305
- $ secondStore ->getBaseUrl (). '?___from_store=default ' ,
308
+ $ secondStore ->getBaseUrl () . '?___from_store=default ' ,
306
309
$ secondStore ->getCurrentUrl ()
307
310
);
308
311
$ this ->assertEquals (
@@ -332,25 +335,25 @@ public function testGetCurrentUrlWithUseStoreInUrlFalse()
332
335
$ product ->setStoreId ($ secondStore ->getId ());
333
336
$ url = $ product ->getUrlInStore ();
334
337
335
- /** @var \Magento\Catalog\Model\CategoryRepository $categoryRepository */
338
+ /** @var \Magento\Catalog\Model\CategoryRepository $categoryRepository */
336
339
$ categoryRepository = $ objectManager ->get (\Magento \Catalog \Model \CategoryRepository::class);
337
340
$ category = $ categoryRepository ->get (333 , $ secondStore ->getStoreId ());
338
341
339
342
$ this ->assertEquals (
340
- $ secondStore ->getBaseUrl (). 'catalog/category/view/s/category-1/id/333/ ' ,
343
+ $ secondStore ->getBaseUrl () . 'catalog/category/view/s/category-1/id/333/ ' ,
341
344
$ category ->getUrl ()
342
345
);
343
346
$ this ->assertEquals (
344
- $ secondStore ->getBaseUrl ().
347
+ $ secondStore ->getBaseUrl () .
345
348
'catalog/product/view/id/333/s/simple-product-three/?___store=fixture_second_store ' ,
346
349
$ url
347
350
);
348
351
$ this ->assertEquals (
349
- $ secondStore ->getBaseUrl (). '?___store=fixture_second_store&___from_store=default ' ,
352
+ $ secondStore ->getBaseUrl () . '?___store=fixture_second_store&___from_store=default ' ,
350
353
$ secondStore ->getCurrentUrl ()
351
354
);
352
355
$ this ->assertEquals (
353
- $ secondStore ->getBaseUrl (). '?___store=fixture_second_store ' ,
356
+ $ secondStore ->getBaseUrl () . '?___store=fixture_second_store ' ,
354
357
$ secondStore ->getCurrentUrl (false )
355
358
);
356
359
}
0 commit comments