Skip to content

Commit 3984a89

Browse files
author
Bohdan Korablov
committed
Merge remote-tracking branch 'falcons/MAGETWO-56787' into MAGETWO-60790
2 parents f1ab6b3 + f93b475 commit 3984a89

File tree

1 file changed

+26
-2
lines changed

1 file changed

+26
-2
lines changed

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

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,12 @@
1111

1212
class UpgradeCommandTest extends \PHPUnit_Framework_TestCase
1313
{
14-
public function testExecute()
14+
/**
15+
* @param array $options
16+
* @param string $expectedString
17+
* @dataProvider executeDataProvider
18+
*/
19+
public function testExecute($options = [], $expectedString ='')
1520
{
1621
$installerFactory = $this->getMock(\Magento\Setup\Model\InstallerFactory::class, [], [], '', false);
1722
$installer = $this->getMock(\Magento\Setup\Model\Installer::class, [], [], '', false);
@@ -20,6 +25,25 @@ public function testExecute()
2025
$installer->expects($this->at(2))->method('installDataFixtures');
2126
$installerFactory->expects($this->once())->method('create')->willReturn($installer);
2227
$commandTester = new CommandTester(new UpgradeCommand($installerFactory));
23-
$this->assertSame(Cli::RETURN_SUCCESS, $commandTester->execute([]));
28+
$this->assertSame(Cli::RETURN_SUCCESS, $commandTester->execute($options));
29+
$this->assertEquals($expectedString, $commandTester->getDisplay());
30+
}
31+
32+
/**
33+
* @return array
34+
*/
35+
public function executeDataProvider()
36+
{
37+
return [
38+
[
39+
'options' => [],
40+
'expectedString' => 'Please re-run Magento compile command. Use the command "setup:di:compile"'
41+
. PHP_EOL
42+
],
43+
[
44+
'options' => ['--keep-generated' => true],
45+
'expectedString' => ''
46+
],
47+
];
2448
}
2549
}

0 commit comments

Comments
 (0)