Skip to content

Commit 0fbf468

Browse files
Merge branch '2.1' into MAGETWO-55463
2 parents ecf2f62 + 0f643ac commit 0fbf468

File tree

4 files changed

+12
-35
lines changed

4 files changed

+12
-35
lines changed

app/code/Magento/Store/etc/di.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,7 @@
223223
<item name="frontName" xsi:type="null" />
224224
<item name="router" xsi:type="string">standard</item>
225225
</item>
226+
<item name="setup" xsi:type="null"/>
226227
</argument>
227228
<argument name="default" xsi:type="string">frontend</argument>
228229
</arguments>

lib/internal/Magento/Framework/App/ObjectManager/ConfigLoader/Compiled.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88

99
use Magento\Framework\ObjectManager\ConfigLoaderInterface;
1010

11+
/**
12+
* Class Compiled returns configuration cache information
13+
*/
1114
class Compiled implements ConfigLoaderInterface
1215
{
1316
/**
@@ -25,8 +28,12 @@ public function load($area)
2528
if (isset($this->configCache[$area])) {
2629
return $this->configCache[$area];
2730
}
28-
$this->configCache[$area] = \unserialize(\file_get_contents(self::getFilePath($area)));
29-
return $this->configCache[$area];
31+
$filePath = self::getFilePath($area);
32+
if (\file_exists($filePath)) {
33+
$this->configCache[$area] = \unserialize(\file_get_contents($filePath));
34+
return $this->configCache[$area];
35+
}
36+
return [];
3037
}
3138

3239
/**

setup/src/Magento/Setup/Console/Command/UpgradeCommand.php

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,6 @@ class UpgradeCommand extends AbstractSetupCommand
2929
*/
3030
private $installerFactory;
3131

32-
/**
33-
* @var \Magento\Setup\Model\ObjectManagerProvider;
34-
*/
35-
private $objectManagerProvider;
36-
3732
/**
3833
* Constructor
3934
*
@@ -43,7 +38,6 @@ class UpgradeCommand extends AbstractSetupCommand
4338
public function __construct(InstallerFactory $installerFactory, ObjectManagerProvider $objectManagerProvider)
4439
{
4540
$this->installerFactory = $installerFactory;
46-
$this->objectManagerProvider = $objectManagerProvider;
4741
parent::__construct();
4842
}
4943

@@ -73,16 +67,6 @@ protected function configure()
7367
*/
7468
protected function execute(InputInterface $input, OutputInterface $output)
7569
{
76-
$areaCode = 'setup';
77-
/** @var \Magento\Framework\ObjectManagerInterface $objectManager */
78-
$objectManager = $this->objectManagerProvider->get();
79-
/** @var \Magento\Framework\App\State $appState */
80-
$appState = $objectManager->get('Magento\Framework\App\State');
81-
$appState->setAreaCode($areaCode);
82-
/** @var \Magento\Framework\ObjectManager\ConfigLoaderInterface $configLoader */
83-
$configLoader = $objectManager->get('Magento\Framework\ObjectManager\ConfigLoaderInterface');
84-
$objectManager->configure($configLoader->load($areaCode));
85-
8670
$keepGenerated = $input->getOption(self::INPUT_KEY_KEEP_GENERATED);
8771
$installer = $this->installerFactory->create(new ConsoleLogger($output));
8872
$installer->updateModulesSequence($keepGenerated);

setup/src/Magento/Setup/Test/Unit/Console/Command/UpgradeCommandTest.php

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,35 +7,20 @@
77

88
use Magento\Setup\Console\Command\UpgradeCommand;
99
use Symfony\Component\Console\Tester\CommandTester;
10+
use Magento\Framework\Console\Cli;
1011

1112
class UpgradeCommandTest extends \PHPUnit_Framework_TestCase
1213
{
1314
public function testExecute()
1415
{
1516
$installerFactory = $this->getMock('Magento\Setup\Model\InstallerFactory', [], [], '', false);
1617
$objectManagerProvider = $this->getMock('\Magento\Setup\Model\ObjectManagerProvider', [], [], '', false);
17-
$objectManager = $this->getMockForAbstractClass('Magento\Framework\ObjectManagerInterface');
18-
$configLoader = $this->getMockForAbstractClass('Magento\Framework\ObjectManager\ConfigLoaderInterface');
19-
$configLoader->expects($this->once())->method('load')->willReturn(['some_key' => 'some_value']);
20-
$state = $this->getMock('Magento\Framework\App\State', [], [], '', false);
21-
$state->expects($this->once())->method('setAreaCode')->with('setup');
22-
$objectManagerProvider->expects($this->once())->method('get')->willReturn($objectManager);
23-
$objectManager->expects($this->once())->method('configure');
24-
$state->expects($this->once())->method('setAreaCode')->with('setup');
2518
$installer = $this->getMock('Magento\Setup\Model\Installer', [], [], '', false);
2619
$installer->expects($this->at(0))->method('updateModulesSequence');
2720
$installer->expects($this->at(1))->method('installSchema');
2821
$installer->expects($this->at(2))->method('installDataFixtures');
2922
$installerFactory->expects($this->once())->method('create')->willReturn($installer);
30-
31-
$objectManager->expects($this->exactly(2))
32-
->method('get')
33-
->will($this->returnValueMap([
34-
['Magento\Framework\App\State', $state],
35-
['Magento\Framework\ObjectManager\ConfigLoaderInterface', $configLoader]
36-
]));
37-
3823
$commandTester = new CommandTester(new UpgradeCommand($installerFactory, $objectManagerProvider));
39-
$commandTester->execute([]);
24+
$this->assertSame(Cli::RETURN_SUCCESS, $commandTester->execute([]));
4025
}
4126
}

0 commit comments

Comments
 (0)