7
7
8
8
namespace OxidEsales \PersonalizationModule \Tests \Integration \Application ;
9
9
10
- use OxidEsales \Eshop \Application \Model \Shop ;
11
10
use OxidEsales \Eshop \Core \Registry ;
12
11
use OxidEsales \EshopCommunity \Internal \Container \ContainerFactory ;
13
12
use OxidEsales \EshopCommunity \Internal \Framework \Module \Configuration \Bridge \ShopConfigurationDaoBridgeInterface ;
14
13
use OxidEsales \EshopCommunity \Internal \Framework \Module \Setup \Bridge \ModuleActivationBridgeInterface ;
14
+ use OxidEsales \EshopEnterprise \Internal \Framework \Module \Configuration \Bridge \ShopConfigurationGeneratorBridgeInterface ;
15
15
use OxidEsales \Facts \Facts ;
16
16
use OxidEsales \PersonalizationModule \Tests \Integration \IntegrationTestCase ;
17
17
@@ -233,7 +233,7 @@ public function testProductsExportWithSubshop()
233
233
$ lines = $ this ->prepareAndExecuteProductExport ();
234
234
$ expectedContent = [
235
235
'ID|SKU|Name|Name_var1|Description|Description_var1|ProductUrl|ProductUrl_var1|ImageUrl|Price|OldPrice|New|Stock|EAN|Brand|ProductCategory ' ,
236
- '8888|8888|"Bar ""Butler"" 6 BOTTLES"|"Bar ""Butler"" 6 BOTTLES"|||%shopUrl%Geschenke/Bar-Butler-6-BOTTLES.html?shp=2|%shopUrl%en/Gifts/Bar-Butler-6-BOTTLES.html?shp=2|%shopUrl%out/pictures/generated/product/1/540_340_75 /nopic.jpg|89.9|94|0|6|||subshopcategoryid '
236
+ '8888|8888|"Bar ""Butler"" 6 BOTTLES"|"Bar ""Butler"" 6 BOTTLES"|||%shopUrl%Geschenke/Bar-Butler-6-BOTTLES.html?shp=2|%shopUrl%en/Gifts/Bar-Butler-6-BOTTLES.html?shp=2|%shopUrl%out/pictures/generated/product/1/800_600_75 /nopic.jpg|89.9|94|0|6|||subshopcategoryid '
237
237
];
238
238
array_walk ($ expectedContent , function (&$ item ) use ($ shopUrl ) {
239
239
$ item = str_replace ('%shopUrl% ' , $ shopUrl , $ item );
@@ -270,43 +270,43 @@ private function prepareAndExecuteProductExport(): array
270
270
271
271
private function prepareSubShop ()
272
272
{
273
- $ subShopId = 2 ;
273
+ $ shopId = 2 ;
274
+
275
+
274
276
$ container = ContainerFactory::getInstance ()->getContainer ();
275
- /** @var ShopConfigurationDaoBridgeInterface $shopConfigurationDaoBridge */
276
- $ shopConfigurationDaoBridge = $ container ->get (ShopConfigurationDaoBridgeInterface::class);
277
- $ shopConfiguration = $ shopConfigurationDaoBridge ->get ();
278
- Registry::getConfig ()->setShopId ($ subShopId );
279
- $ shopConfigurationDaoBridge ->save ($ shopConfiguration );
280
-
281
- // $this->activateModule('oepersonalization');
282
- Registry::getConfig ()->saveShopConfVar ('arr ' ,'aCurrencies ' , [
277
+ $ shopConfiguration = $ container ->get (ShopConfigurationDaoBridgeInterface::class)->get (1 );
278
+ $ container ->get (ShopConfigurationDaoBridgeInterface::class)->save ($ shopConfiguration );
279
+ $ container ->get (ShopConfigurationGeneratorBridgeInterface::class)->generateForShop ($ shopId );
280
+
281
+ $ config = Registry::getConfig ();
282
+ $ config ->setShopId ($ shopId );
283
+ $ config ->saveShopConfVar ('arr ' ,'aCurrencies ' , [
283
284
'EUR@ 1.00@ ,@ .@ €@ 2 ' ,
284
285
'GBP@ 0.8565@ .@ @ £@ 2 ' ,
285
286
'CHF@ 1.4326@ ,@ .@ <small>CHF</small>@ 2 ' ,
286
287
'USD@ 1.2994@ .@ @ $@ 2 ' ,
287
- ], $ subShopId );
288
-
289
- Registry::getConfig ()->saveShopConfVar ('arr ' ,'aDetailImageSizes ' , [
290
- 'oxpic1 ' => '540*340 ' ,
291
- 'oxpic2 ' => '540*340 ' ,
292
- 'oxpic3 ' => '540*340 ' ,
293
- 'oxpic4 ' => '540*340 ' ,
294
- 'oxpic5 ' => '540*340 ' ,
295
- 'oxpic6 ' => '540*340 ' ,
296
- 'oxpic7 ' => '540*340 ' ,
297
- 'oxpic8 ' => '540*340 ' ,
298
- 'oxpic9 ' => '540*340 ' ,
299
- 'oxpic10 ' => '540*340 ' ,
300
- 'oxpic11 ' => '540*340 ' ,
301
- 'oxpic12 ' => '540*340 ' ,
302
- ], $ subShopId );
303
-
304
- Registry::getConfig ()->saveShopConfVar ('string ' ,'sDefaultImageQuality ' , '75 ' , $ subShopId );
305
- Registry::getConfig ()->saveShopConfVar ('bool ' , 'bl_perfLoadPrice ' , true , $ subShopId );
306
-
307
- $ shop = oxNew (Shop::class);
308
- $ shop ->load ($ subShopId );
309
- $ shop ->generateViews ();
288
+ ], 2 );
289
+ $ config ->saveShopConfVar ('arr ' ,'aDetailImageSizes ' , [
290
+ 'oxpic1 ' => '800*600 ' ,
291
+ 'oxpic2 ' => '800*600 ' ,
292
+ 'oxpic3 ' => '800*600 ' ,
293
+ 'oxpic4 ' => '800*600 ' ,
294
+ 'oxpic5 ' => '800*600 ' ,
295
+ 'oxpic6 ' => '800*600 ' ,
296
+ 'oxpic7 ' => '800*600 ' ,
297
+ 'oxpic8 ' => '800*600 ' ,
298
+ 'oxpic9 ' => '800*600 ' ,
299
+ 'oxpic10 ' => '800*600 ' ,
300
+ 'oxpic11 ' => '800*600 ' ,
301
+ 'oxpic12 ' => '800*600 ' ,
302
+ ], 2 );
303
+ $ config ->saveShopConfVar ('string ' ,'sDefaultImageQuality ' , '75 ' , 2 );
304
+ $ config ->saveShopConfVar ('bool ' , 'bl_perfLoadPrice ' , true );
305
+
306
+ $ this ->regenerateDatabaseViews ();
307
+ $ this ->activateModule ();
308
+
309
+ ContainerFactory::resetContainer ();
310
310
}
311
311
312
312
/**
@@ -319,12 +319,12 @@ private function isEnterpriseEdition(): bool
319
319
return ('EE ' === $ facts ->getEdition ());
320
320
}
321
321
322
- public function activateModule ($ moduleId )
322
+ public function activateModule ()
323
323
{
324
324
$ container = ContainerFactory::getInstance ()->getContainer ();
325
325
/** @var ModuleActivationBridgeInterface $moduleService */
326
326
$ moduleService = $ container ->get (ModuleActivationBridgeInterface::class);
327
- $ moduleService ->activate ($ moduleId , Registry::getConfig ()->getShopId ());
327
+ $ moduleService ->activate (' oepersonalization ' , Registry::getConfig ()->getShopId ());
328
328
}
329
329
330
330
/**
@@ -345,4 +345,10 @@ protected function prepareShopStructureForExport()
345
345
{
346
346
return Registry::getConfig ()->getConfigParam ('sShopDir ' );
347
347
}
348
+
349
+ private function regenerateDatabaseViews (): void
350
+ {
351
+ $ vendorPath = (new Facts ())->getVendorPath ();
352
+ exec ($ vendorPath . '/bin/oe-eshop-db_views_generate ' );
353
+ }
348
354
}
0 commit comments