Skip to content

Commit 721be70

Browse files
Merge branch 'MAGETWO-53777' of https://github.com/magento-tango/magento2ce into MAGETWO-55147
2 parents 471976c + 6d13f23 commit 721be70

File tree

2 files changed

+4
-38
lines changed

2 files changed

+4
-38
lines changed

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

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
use Magento\Framework\Setup\ConsoleLogger;
99
use Magento\Setup\Model\InstallerFactory;
10-
use Magento\Setup\Model\ObjectManagerProvider;
1110
use Symfony\Component\Console\Input\InputInterface;
1211
use Symfony\Component\Console\Input\InputOption;
1312
use Symfony\Component\Console\Output\OutputInterface;
@@ -29,21 +28,14 @@ class UpgradeCommand extends AbstractSetupCommand
2928
*/
3029
private $installerFactory;
3130

32-
/**
33-
* @var \Magento\Setup\Model\ObjectManagerProvider;
34-
*/
35-
private $objectManagerProvider;
36-
3731
/**
3832
* Constructor
3933
*
4034
* @param InstallerFactory $installerFactory
41-
* @param ObjectManagerProvider $objectManagerProvider
4235
*/
43-
public function __construct(InstallerFactory $installerFactory, ObjectManagerProvider $objectManagerProvider)
36+
public function __construct(InstallerFactory $installerFactory)
4437
{
4538
$this->installerFactory = $installerFactory;
46-
$this->objectManagerProvider = $objectManagerProvider;
4739
parent::__construct();
4840
}
4941

@@ -73,16 +65,6 @@ protected function configure()
7365
*/
7466
protected function execute(InputInterface $input, OutputInterface $output)
7567
{
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-
8668
$keepGenerated = $input->getOption(self::INPUT_KEY_KEEP_GENERATED);
8769
$installer = $this->installerFactory->create(new ConsoleLogger($output));
8870
$installer->updateModulesSequence($keepGenerated);

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

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,35 +7,19 @@
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);
16-
$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');
2517
$installer = $this->getMock('Magento\Setup\Model\Installer', [], [], '', false);
2618
$installer->expects($this->at(0))->method('updateModulesSequence');
2719
$installer->expects($this->at(1))->method('installSchema');
2820
$installer->expects($this->at(2))->method('installDataFixtures');
2921
$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-
38-
$commandTester = new CommandTester(new UpgradeCommand($installerFactory, $objectManagerProvider));
39-
$commandTester->execute([]);
22+
$commandTester = new CommandTester(new UpgradeCommand($installerFactory));
23+
$this->assertSame(Cli::RETURN_SUCCESS, $commandTester->execute([]));
4024
}
4125
}

0 commit comments

Comments
 (0)