Skip to content

Commit 2aa58df

Browse files
committed
MAGETWO-51544: [Github] Cannot upgrade to Magento 2.0.4 #4013
- Code review comment update. - Consider ["extra"]["map"] section absence in base package a valid scenario
1 parent c7d2822 commit 2aa58df

File tree

2 files changed

+8
-17
lines changed

2 files changed

+8
-17
lines changed

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

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ public function build()
4545
// Locate composer.json for magento2-base module and read the extra map section for the list of
4646
// magento specific files and directories that updater will need access to perform the upgrade
4747

48+
$filesPathList = [];
4849
$vendorDir = require VENDOR_PATH;
4950
$basePackageComposerFilePath = $vendorDir . '/' . self::MAGENTO_BASE_PACKAGE_COMPOSER_JSON_FILE;
5051
if (!$this->reader->isExist($basePackageComposerFilePath)) {
@@ -59,17 +60,12 @@ public function build()
5960
}
6061
$composerJsonFileData = json_decode($this->reader->readFile($basePackageComposerFilePath), true);
6162
if (!isset($composerJsonFileData[self::COMPOSER_KEY_EXTRA][self::COMPOSER_KEY_MAP])) {
62-
throw new \Magento\Setup\Exception(
63-
'Could not find "extra" => "map" section within '
64-
. self::MAGENTO_BASE_PACKAGE_COMPOSER_JSON_FILE
65-
. ' file.'
66-
);
63+
return $filesPathList;
6764
}
6865
$extraMappings = $composerJsonFileData[self::COMPOSER_KEY_EXTRA][self::COMPOSER_KEY_MAP];
69-
$fileAndPathList = [];
7066
foreach ($extraMappings as $map) {
71-
$fileAndPathList[] = $map[1];
67+
$filesPathList[] = $map[1];
7268
}
73-
return $fileAndPathList;
69+
return $filesPathList;
7470
}
7571
}

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

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public function testBuildComposerJsonFileNotReadable()
7070
$this->pathBuilder->build();
7171
}
7272

73-
// Error scenario: ["extra"]["map"] is absent within magento/magento2-base/composer.json file
73+
// Scenario: ["extra"]["map"] is absent within magento/magento2-base/composer.json file
7474
public function testBuildNoExtraMapSectionInComposerJsonFile()
7575
{
7676
$this->readerMock->expects($this->once())->method('isExist')->willReturn(true);
@@ -85,14 +85,9 @@ public function testBuildNoExtraMapSectionInComposerJsonFile()
8585
]
8686
);
8787
$this->readerMock->expects($this->once())->method('readFile')->willReturn($jsonData);
88-
$this->setExpectedException(
89-
'Magento\Setup\Exception',
90-
sprintf(
91-
'Could not find "extra" => "map" section within %s file.',
92-
PathBuilder::MAGENTO_BASE_PACKAGE_COMPOSER_JSON_FILE
93-
)
94-
);
95-
$this->pathBuilder->build();
88+
$expectedList = [];
89+
$actualList = $this->pathBuilder->build();
90+
$this->assertEquals($expectedList, $actualList);
9691
}
9792

9893
// Success scenario

0 commit comments

Comments
 (0)