diff --git a/app/code/Magento/Developer/Console/Command/DevTestsRunCommand.php b/app/code/Magento/Developer/Console/Command/DevTestsRunCommand.php
index f26f0d5e79325..4f7b15c916da5 100644
--- a/app/code/Magento/Developer/Console/Command/DevTestsRunCommand.php
+++ b/app/code/Magento/Developer/Console/Command/DevTestsRunCommand.php
@@ -8,6 +8,7 @@
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
+use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
/**
@@ -22,10 +23,16 @@ class DevTestsRunCommand extends Command
*/
const INPUT_ARG_TYPE = 'type';
+ /**
+ * PHPUnit arguments parameter
+ */
+ const INPUT_OPT_COMMAND_ARGUMENTS = 'arguments';
+ const INPUT_OPT_COMMAND_ARGUMENTS_SHORT = 'c';
+
/**
* command name
*/
- const COMMAND_NAME = 'dev:tests:run';
+ const COMMAND_NAME = 'dev:tests:run';
/**
* Maps types (from user input) to phpunit test names
@@ -56,6 +63,13 @@ protected function configure()
'Type of test to run. Available types: ' . implode(', ', array_keys($this->types)),
'default'
);
+ $this->addOption(
+ self::INPUT_OPT_COMMAND_ARGUMENTS,
+ self::INPUT_OPT_COMMAND_ARGUMENTS_SHORT,
+ InputOption::VALUE_REQUIRED,
+ 'Additional arguments for PHPUnit. Example: "-c\'--filter=MyTest\'" (no spaces)',
+ ''
+ );
parent::configure();
}
@@ -87,6 +101,9 @@ protected function execute(InputInterface $input, OutputInterface $output)
$dirName = realpath(BP . '/dev/tests/' . $dir);
chdir($dirName);
$command = PHP_BINARY . ' ' . BP . '/' . $vendorDir . '/phpunit/phpunit/phpunit ' . $options;
+ if ($commandArguments = $input->getOption(self::INPUT_OPT_COMMAND_ARGUMENTS)) {
+ $command .= ' ' . $commandArguments;
+ }
$message = $dirName . '> ' . $command;
$output->writeln(['', str_pad("---- {$message} ", 70, '-'), '']);
passthru($command, $returnVal);
diff --git a/app/code/Magento/Developer/Test/Unit/Console/Command/DevTestsRunCommandTest.php b/app/code/Magento/Developer/Test/Unit/Console/Command/DevTestsRunCommandTest.php
index 8ba3bd50ef301..862cdc336b803 100644
--- a/app/code/Magento/Developer/Test/Unit/Console/Command/DevTestsRunCommandTest.php
+++ b/app/code/Magento/Developer/Test/Unit/Console/Command/DevTestsRunCommandTest.php
@@ -34,4 +34,20 @@ public function testExecuteBadType()
$commandTester->execute([DevTestsRunCommand::INPUT_ARG_TYPE => 'bad']);
$this->assertContains('Invalid type: "bad"', $commandTester->getDisplay());
}
+
+ public function testPassArgumentsToPHPUnit()
+ {
+ $commandTester = new CommandTester($this->command);
+ $commandTester->execute(
+ [
+ DevTestsRunCommand::INPUT_ARG_TYPE => 'unit',
+ '-' . DevTestsRunCommand::INPUT_OPT_COMMAND_ARGUMENTS_SHORT => '--list-suites',
+ ]
+ );
+ $this->assertContains(
+ 'phpunit --list-suites',
+ $commandTester->getDisplay(),
+ 'Parameters should be passed to PHPUnit'
+ );
+ }
}
diff --git a/app/code/Magento/Sales/Test/Unit/Ui/Component/Listing/Column/AddressTest.php b/app/code/Magento/Sales/Test/Unit/Ui/Component/Listing/Column/AddressTest.php
index 1a903ab68952c..c79b06da60c4e 100644
--- a/app/code/Magento/Sales/Test/Unit/Ui/Component/Listing/Column/AddressTest.php
+++ b/app/code/Magento/Sales/Test/Unit/Ui/Component/Listing/Column/AddressTest.php
@@ -47,7 +47,7 @@ public function testPrepareDataSource()
{
$itemName = 'itemName';
$oldItemValue = "itemValue\n";
- $newItemValue = 'itemValue
';
+ $newItemValue = "itemValue
\n";
$dataSource = [
'data' => [
'items' => [
@@ -57,7 +57,7 @@ public function testPrepareDataSource()
];
$this->model->setData('name', $itemName);
- $this->escaper->expects($this->once())->method('escapeHtml')->with($newItemValue)->willReturnArgument(0);
+ $this->escaper->expects($this->any())->method('escapeHtml')->with($oldItemValue)->willReturnArgument(0);
$dataSource = $this->model->prepareDataSource($dataSource);
$this->assertEquals($newItemValue, $dataSource['data']['items'][0][$itemName]);
}
diff --git a/app/code/Magento/Sales/Ui/Component/Listing/Column/Address.php b/app/code/Magento/Sales/Ui/Component/Listing/Column/Address.php
index 23a6e7a41a5b7..d900bb7ba670f 100644
--- a/app/code/Magento/Sales/Ui/Component/Listing/Column/Address.php
+++ b/app/code/Magento/Sales/Ui/Component/Listing/Column/Address.php
@@ -49,9 +49,7 @@ public function prepareDataSource(array $dataSource)
{
if (isset($dataSource['data']['items'])) {
foreach ($dataSource['data']['items'] as & $item) {
- $item[$this->getData('name')] = $this->escaper->escapeHtml(
- str_replace("\n", '
', $item[$this->getData('name')])
- );
+ $item[$this->getData('name')] = nl2br($this->escaper->escapeHtml($item[$this->getData('name')]));
}
}
diff --git a/setup/src/Magento/Setup/Console/Command/BackupCommand.php b/setup/src/Magento/Setup/Console/Command/BackupCommand.php
index fafa47296d304..a6ec091cc50b0 100644
--- a/setup/src/Magento/Setup/Console/Command/BackupCommand.php
+++ b/setup/src/Magento/Setup/Console/Command/BackupCommand.php
@@ -57,6 +57,12 @@ class BackupCommand extends AbstractSetupCommand
*/
private $deploymentConfig;
+ /**
+ * The initial maintenance mode state
+ * @var bool
+ */
+ private $maintenanceModeInitialState;
+
/**
* Constructor
*
@@ -73,6 +79,7 @@ public function __construct(
$this->maintenanceMode = $maintenanceMode;
$this->backupRollbackFactory = $this->objectManager->get(\Magento\Framework\Setup\BackupRollbackFactory::class);
$this->deploymentConfig = $deploymentConfig;
+ $this->maintenanceModeInitialState = $this->maintenanceMode->isOn();
parent::__construct();
}
@@ -109,6 +116,7 @@ protected function configure()
/**
* {@inheritdoc}
+ * @SuppressWarnings(PHPMD.CyclomaticComplexity)
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
@@ -147,8 +155,11 @@ protected function execute(InputInterface $input, OutputInterface $output)
$output->writeln('' . $e->getMessage() . '');
$returnValue = \Magento\Framework\Console\Cli::RETURN_FAILURE;
} finally {
- $output->writeln('Disabling maintenance mode');
- $this->maintenanceMode->set(false);
+ // Only disable maintenace mode if it wasn't turned on before
+ if (!$this->maintenanceModeInitialState) {
+ $output->writeln('Disabling maintenance mode');
+ $this->maintenanceMode->set(false);
+ }
}
return $returnValue;
}