Skip to content

Commit 5a2ea65

Browse files
MC-30236: Upgrade from 2.3.x CE with SD to 2.3.x EE AreaCode Exception
- fix unit and integration tests
1 parent 25886c2 commit 5a2ea65

File tree

2 files changed

+21
-7
lines changed

2 files changed

+21
-7
lines changed

setup/src/Magento/Setup/Model/Installer.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1261,7 +1261,7 @@ public function uninstall()
12611261
}
12621262

12631263
/**
1264-
* Enable or disable caches for specific types
1264+
* Enable or disable caches for specific types that are available
12651265
*
12661266
* If no types are specified then it will enable or disable all available types
12671267
* Note this is called by install() via callback.
@@ -1275,9 +1275,10 @@ private function updateCaches($isEnabled, $types = [])
12751275
/** @var \Magento\Framework\App\Cache\Manager $cacheManager */
12761276
$cacheManager = $this->objectManagerProvider->get()->create(\Magento\Framework\App\Cache\Manager::class);
12771277

1278-
$types = empty($types) ? $cacheManager->getAvailableTypes() : $types;
1278+
$availableTypes = $cacheManager->getAvailableTypes();
1279+
$types = empty($types) ? $availableTypes : array_intersect($availableTypes, $types);
12791280
$enabledTypes = $cacheManager->setEnabled($types, $isEnabled);
1280-
if($isEnabled){
1281+
if ($isEnabled) {
12811282
$cacheManager->clean($enabledTypes);
12821283
}
12831284

setup/src/Magento/Setup/Test/Unit/Model/InstallerTest.php

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -307,8 +307,9 @@ public function testInstall(array $request, array $logMessages)
307307
$dataSetup->expects($this->any())->method('getConnection')->willReturn($connection);
308308
$cacheManager = $this->createMock(\Magento\Framework\App\Cache\Manager::class);
309309
$cacheManager->expects($this->any())->method('getAvailableTypes')->willReturn(['foo', 'bar']);
310-
$cacheManager->expects($this->once())->method('setEnabled')->willReturn(['foo', 'bar']);
311-
$cacheManager->expects($this->any())->method('clean');
310+
$cacheManager->expects($this->exactly(3))->method('setEnabled')->willReturn(['foo', 'bar']);
311+
$cacheManager->expects($this->exactly(3))->method('clean');
312+
$cacheManager->expects($this->exactly(3))->method('getStatus')->willReturn([]);
312313
$appState = $this->getMockBuilder(\Magento\Framework\App\State::class)
313314
->disableOriginalConstructor()
314315
->disableArgumentCloning()
@@ -410,15 +411,21 @@ public function installDataProvider()
410411
['Installing user configuration...'],
411412
['Enabling caches:'],
412413
['Current status:'],
413-
[''],
414+
[print_r([],true)],
414415
['Installing data...'],
415416
['Data install/update:'],
417+
['Disabling caches:'],
418+
['Current status:'],
419+
[print_r([],true)],
416420
['Module \'Foo_One\':'],
417421
['Module \'Bar_Two\':'],
418422
['Data post-updates:'],
419423
['Module \'Foo_One\':'],
420424
['Module \'Bar_Two\':'],
421425
//['Installing admin user...'],
426+
['Enabling caches:'],
427+
['Current status:'],
428+
[print_r([],true)],
422429
['Caches clearing:'],
423430
['Cache cleared successfully'],
424431
['Disabling Maintenance Mode:'],
@@ -456,14 +463,20 @@ public function installDataProvider()
456463
['Installing user configuration...'],
457464
['Enabling caches:'],
458465
['Current status:'],
459-
[''],
466+
[print_r([],true)],
460467
['Installing data...'],
461468
['Data install/update:'],
469+
['Disabling caches:'],
470+
['Current status:'],
471+
[print_r([],true)],
462472
['Module \'Foo_One\':'],
463473
['Module \'Bar_Two\':'],
464474
['Data post-updates:'],
465475
['Module \'Foo_One\':'],
466476
['Module \'Bar_Two\':'],
477+
['Enabling caches:'],
478+
['Current status:'],
479+
[print_r([],true)],
467480
['Installing admin user...'],
468481
['Caches clearing:'],
469482
['Cache cleared successfully'],

0 commit comments

Comments
 (0)