-
Notifications
You must be signed in to change notification settings - Fork 9.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1459 from magento-thunder/bugfixes-delivery
Bug - MAGETWO-49796 Catalog top nav, CSS class not set to active when using Varnish - MAGETWO-71890 Magento fails with deploymentConfig present on new install
- Loading branch information
Showing
7 changed files
with
300 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
namespace Magento\Deploy\Console; | ||
|
||
use Magento\Framework\ObjectManagerInterface; | ||
|
||
/** | ||
* Provides list of commands to be available for uninstalled application | ||
*/ | ||
class CommandList implements \Magento\Framework\Console\CommandListInterface | ||
{ | ||
/** | ||
* Object Manager | ||
* | ||
* @var ObjectManagerInterface | ||
*/ | ||
private $objectManager; | ||
|
||
/** | ||
* @param ObjectManagerInterface $objectManager Object Manager | ||
*/ | ||
public function __construct(ObjectManagerInterface $objectManager) | ||
{ | ||
$this->objectManager = $objectManager; | ||
} | ||
|
||
/** | ||
* Gets list of command classes | ||
* | ||
* @return string[] | ||
*/ | ||
private function getCommandsClasses() | ||
{ | ||
return [ | ||
\Magento\Deploy\Console\Command\App\ConfigImportCommand::class, | ||
]; | ||
} | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
public function getCommands() | ||
{ | ||
$commands = []; | ||
foreach ($this->getCommandsClasses() as $class) { | ||
if (class_exists($class)) { | ||
$commands[] = $this->objectManager->get($class); | ||
} else { | ||
throw new \Exception('Class ' . $class . ' does not exist'); | ||
} | ||
} | ||
|
||
return $commands; | ||
} | ||
} |
58 changes: 58 additions & 0 deletions
58
app/code/Magento/Deploy/Test/Unit/Console/CommandListTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
namespace Magento\Deploy\Test\Unit\Console; | ||
|
||
use Magento\Deploy\Console\Command\App\ConfigImportCommand; | ||
use Magento\Deploy\Console\CommandList; | ||
use Magento\Framework\ObjectManagerInterface; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
class CommandListTest extends TestCase | ||
{ | ||
/** | ||
* @var CommandList | ||
*/ | ||
private $model; | ||
|
||
/** | ||
* @var ObjectManagerInterface|\PHPUnit_Framework_MockObject_MockObject | ||
*/ | ||
private $objectManagerMock; | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
protected function setUp() | ||
{ | ||
$this->objectManagerMock = $this->getMockBuilder(ObjectManagerInterface::class) | ||
->getMockForAbstractClass(); | ||
|
||
$this->model = new CommandList( | ||
$this->objectManagerMock | ||
); | ||
} | ||
|
||
public function testGetCommands() | ||
{ | ||
$configImportCommand = $this->getMockBuilder(ConfigImportCommand::class) | ||
->disableOriginalConstructor() | ||
->getMock(); | ||
|
||
$this->objectManagerMock->expects($this->once()) | ||
->method('get') | ||
->willReturnMap([ | ||
[ConfigImportCommand::class, $configImportCommand], | ||
]); | ||
|
||
$this->assertSame( | ||
[$configImportCommand], | ||
$this->model->getCommands() | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
if (PHP_SAPI == 'cli') { | ||
\Magento\Framework\Console\CommandLocator::register(\Magento\Deploy\Console\CommandList::class); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,7 @@ | |
], | ||
"autoload": { | ||
"files": [ | ||
"cli_commands.php", | ||
"registration.php" | ||
], | ||
"psr-4": { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.