Skip to content

Commit 711ea5d

Browse files
merge magento/2.2.10-develop into magento-trigger/MC-18831
2 parents d9b60f3 + 3c10b02 commit 711ea5d

File tree

13 files changed

+283
-229
lines changed

13 files changed

+283
-229
lines changed

app/code/Magento/Indexer/Console/Command/IndexerStatusCommand.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
use Symfony\Component\Console\Output\OutputInterface;
1010
use Magento\Framework\Indexer;
1111
use Magento\Framework\Mview;
12+
use Symfony\Component\Console\Helper\Table as TableHelper;
1213

1314
/**
1415
* Command for displaying status of indexers.
@@ -32,7 +33,8 @@ protected function configure()
3233
*/
3334
protected function execute(InputInterface $input, OutputInterface $output)
3435
{
35-
$table = $this->getHelperSet()->get('table');
36+
/** @var TableHelper $table */
37+
$table = $this->getObjectManager()->create(TableHelper::class, ['output' => $output]);
3638
$table->setHeaders(['Title', 'Status', 'Update On', 'Schedule Status', 'Schedule Updated']);
3739

3840
$rows = [];
@@ -63,7 +65,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
6365
});
6466

6567
$table->addRows($rows);
66-
$table->render($output);
68+
$table->render();
6769
}
6870

6971
/**

app/code/Magento/Indexer/Test/Unit/Console/Command/IndexerStatusCommandTest.php

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
use Magento\Framework\Indexer\StateInterface;
99
use Magento\Indexer\Console\Command\IndexerStatusCommand;
1010
use Symfony\Component\Console\Tester\CommandTester;
11-
use Symfony\Component\Console\Helper\HelperSet;
12-
use Symfony\Component\Console\Helper\TableHelper;
1311

1412
class IndexerStatusCommandTest extends AbstractIndexerCommandCommonSetup
1513
{
@@ -92,14 +90,11 @@ public function testExecuteAll(array $indexers)
9290

9391
$this->initIndexerCollectionByItems($indexerMocks);
9492
$this->command = new IndexerStatusCommand($this->objectManagerFactory);
95-
9693
$objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
97-
98-
$this->command->setHelperSet(
99-
$objectManager->getObject(
100-
HelperSet::class,
101-
['helpers' => [$objectManager->getObject(TableHelper::class)]]
102-
)
94+
$this->objectManager->method('create')->willReturnCallback(
95+
function ($class, $arguments) use ($objectManager) {
96+
return $objectManager->getObject($class, $arguments);
97+
}
10398
);
10499

105100
$commandTester = new CommandTester($this->command);

app/code/Magento/Store/Console/Command/StoreListCommand.php

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,12 @@
66
*/
77
namespace Magento\Store\Console\Command;
88

9+
use Magento\Framework\App\ObjectManager;
910
use Symfony\Component\Console\Input\InputInterface;
1011
use Symfony\Component\Console\Output\OutputInterface;
1112
use Symfony\Component\Console\Command\Command;
13+
use Symfony\Component\Console\Helper\Table as TableHelper;
14+
use Symfony\Component\Console\Helper\TableFactory as TableHelperFactory;
1215

1316
/**
1417
* Class StoreListCommand
@@ -23,11 +26,19 @@ class StoreListCommand extends Command
2326
private $storeManager;
2427

2528
/**
29+
* @var TableHelperFactory
30+
*/
31+
private $tableHelperFactory;
32+
33+
/**
34+
* @inheritDoc
2635
*/
2736
public function __construct(
28-
\Magento\Store\Model\StoreManagerInterface $storeManager
37+
\Magento\Store\Model\StoreManagerInterface $storeManager,
38+
TableHelperFactory $tableHelperFactory = null
2939
) {
3040
$this->storeManager = $storeManager;
41+
$this->tableHelperFactory = $tableHelperFactory ?? ObjectManager::getInstance()->get(TableHelperFactory::class);
3142
parent::__construct();
3243
}
3344

@@ -48,7 +59,8 @@ protected function configure()
4859
protected function execute(InputInterface $input, OutputInterface $output)
4960
{
5061
try {
51-
$table = $this->getHelperSet()->get('table');
62+
/** @var TableHelper $table */
63+
$table = $this->tableHelperFactory->create(['output' => $output]);
5264
$table->setHeaders(['ID', 'Website ID', 'Group ID', 'Name', 'Code', 'Sort Order', 'Is Active']);
5365

5466
foreach ($this->storeManager->getStores(true, true) as $store) {
@@ -63,7 +75,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
6375
]);
6476
}
6577

66-
$table->render($output);
78+
$table->render();
6779

6880
return \Magento\Framework\Console\Cli::RETURN_SUCCESS;
6981
} catch (\Exception $e) {

app/code/Magento/Store/Console/Command/WebsiteListCommand.php

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,12 @@
66
*/
77
namespace Magento\Store\Console\Command;
88

9+
use Magento\Framework\App\ObjectManager;
910
use Symfony\Component\Console\Input\InputInterface;
1011
use Symfony\Component\Console\Output\OutputInterface;
1112
use Symfony\Component\Console\Command\Command;
13+
use Symfony\Component\Console\Helper\Table as TableHelper;
14+
use Symfony\Component\Console\Helper\TableFactory as TableHelperFactory;
1215

1316
/**
1417
* Class WebsiteListCommand
@@ -23,11 +26,19 @@ class WebsiteListCommand extends Command
2326
private $manager;
2427

2528
/**
29+
* @var TableHelperFactory
30+
*/
31+
private $tableHelperFactory;
32+
33+
/**
34+
* @inheritDoc
2635
*/
2736
public function __construct(
28-
\Magento\Store\Api\WebsiteRepositoryInterface $websiteManagement
37+
\Magento\Store\Api\WebsiteRepositoryInterface $websiteManagement,
38+
TableHelperFactory $tableHelperFactory = null
2939
) {
3040
$this->manager = $websiteManagement;
41+
$this->tableHelperFactory = $tableHelperFactory ?? ObjectManager::getInstance()->get(TableHelperFactory::class);
3142
parent::__construct();
3243
}
3344

@@ -48,7 +59,7 @@ protected function configure()
4859
protected function execute(InputInterface $input, OutputInterface $output)
4960
{
5061
try {
51-
$table = $this->getHelperSet()->get('table');
62+
$table = $this->tableHelperFactory->create(['output' => $output]);
5263
$table->setHeaders(['ID', 'Default Group Id', 'Name', 'Code', 'Sort Order', 'Is Default']);
5364

5465
foreach ($this->manager->getList() as $website) {

app/code/Magento/Store/Test/Unit/Console/Command/StoreListCommandTest.php

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
namespace Magento\Store\Test\Unit\Console\Command;
77

88
use Magento\Store\Console\Command\StoreListCommand;
9+
use Symfony\Component\Console\Helper\Table;
10+
use Symfony\Component\Console\Helper\TableFactory;
911
use Symfony\Component\Console\Tester\CommandTester;
10-
use Symfony\Component\Console\Helper\HelperSet;
11-
use Symfony\Component\Console\Helper\TableHelper;
1212
use Magento\Store\Model\Store;
1313
use Magento\Framework\Console\Cli;
1414

@@ -38,19 +38,21 @@ protected function setUp()
3838

3939
$this->storeManagerMock = $this->getMockForAbstractClass(\Magento\Store\Model\StoreManagerInterface::class);
4040

41+
$tableHelperFactory = $this->getMockBuilder(TableFactory::class)->disableOriginalConstructor()->getMock();
42+
$tableHelperFactory->method('create')
43+
->willReturnCallback(
44+
function ($arguments) {
45+
return $this->objectManager->getObject(Table::class, $arguments);
46+
}
47+
);
48+
4149
$this->command = $this->objectManager->getObject(
4250
StoreListCommand::class,
43-
['storeManager' => $this->storeManagerMock]
44-
);
45-
46-
/** @var HelperSet $helperSet */
47-
$helperSet = $this->objectManager->getObject(
48-
HelperSet::class,
49-
['helpers' => [$this->objectManager->getObject(TableHelper::class)]]
51+
[
52+
'storeManager' => $this->storeManagerMock,
53+
'tableHelperFactory' => $tableHelperFactory
54+
]
5055
);
51-
52-
//Inject table helper for output
53-
$this->command->setHelperSet($helperSet);
5456
}
5557

5658
public function testExecuteExceptionNoVerbosity()

app/code/Magento/Store/Test/Unit/Console/Command/WebsiteListCommandTest.php

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
namespace Magento\Store\Test\Unit\Console\Command;
77

88
use Magento\Store\Console\Command\WebsiteListCommand;
9+
use Symfony\Component\Console\Helper\Table;
10+
use Symfony\Component\Console\Helper\TableFactory;
911
use Symfony\Component\Console\Tester\CommandTester;
10-
use Symfony\Component\Console\Helper\HelperSet;
11-
use Symfony\Component\Console\Helper\TableHelper;
1212
use Magento\Store\Model\Website;
1313
use Magento\Framework\Console\Cli;
1414
use Magento\Store\Api\WebsiteRepositoryInterface;
@@ -39,19 +39,21 @@ protected function setUp()
3939

4040
$this->websiteRepositoryMock = $this->getMockForAbstractClass(WebsiteRepositoryInterface::class);
4141

42+
$tableHelperFactory = $this->getMockBuilder(TableFactory::class)->disableOriginalConstructor()->getMock();
43+
$tableHelperFactory->method('create')
44+
->willReturnCallback(
45+
function ($arguments) {
46+
return $this->objectManager->getObject(Table::class, $arguments);
47+
}
48+
);
49+
4250
$this->command = $this->objectManager->getObject(
4351
WebsiteListCommand::class,
44-
['websiteManagement' => $this->websiteRepositoryMock]
45-
);
46-
47-
/** @var HelperSet $helperSet */
48-
$helperSet = $this->objectManager->getObject(
49-
HelperSet::class,
50-
['helpers' => [$this->objectManager->getObject(TableHelper::class)]]
52+
[
53+
'websiteManagement' => $this->websiteRepositoryMock,
54+
'tableHelperFactory' => $tableHelperFactory
55+
]
5156
);
52-
53-
//Inject table helper for output
54-
$this->command->setHelperSet($helperSet);
5557
}
5658

5759
public function testExecuteExceptionNoVerbosity()

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@
4848
"tubalmartin/cssmin": "4.1.1",
4949
"magento/magento-composer-installer": ">=0.1.11",
5050
"braintree/braintree_php": "3.28.0",
51-
"symfony/console": "~2.3, !=2.7.0",
51+
"symfony/console": "~2.3 || ~3.4, !=2.7.0",
5252
"symfony/event-dispatcher": "~2.1",
53-
"symfony/process": "~2.1",
53+
"symfony/process": "~2.1 || ~3.4",
5454
"phpseclib/mcrypt_compat": "1.0.8",
5555
"phpseclib/phpseclib": "2.0.*",
5656
"tedivm/jshrink": "~1.3.0",

0 commit comments

Comments
 (0)