Skip to content

Commit e826be9

Browse files
author
Dale Sikkema
committed
Merge branch 'MAGETWO-37504-st-compiler' into develop
2 parents cc7b10e + 19a3e9f commit e826be9

File tree

2 files changed

+28
-14
lines changed

2 files changed

+28
-14
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class DiCompileCommand extends Command
4040

4141
/** @var array */
4242
private $excludedPathsList;
43-
43+
4444
/**
4545
* Constructor
4646
*

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

Lines changed: 27 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,26 +10,24 @@
1010

1111
class DiCompileCommandTest extends \PHPUnit_Framework_TestCase
1212
{
13-
/**
14-
* @var \Magento\Framework\App\DeploymentConfig|\PHPUnit_Framework_MockObject_MockObject
15-
*/
13+
/** @var \Magento\Framework\App\DeploymentConfig|\PHPUnit_Framework_MockObject_MockObject */
1614
private $deploymentConfig;
1715

18-
/**
19-
* @var \Magento\Setup\Module\Di\App\Task\Manager|\PHPUnit_Framework_MockObject_MockObject
20-
*/
16+
/** @var \Magento\Setup\Module\Di\App\Task\Manager|\PHPUnit_Framework_MockObject_MockObject */
2117
private $manager;
2218

23-
/**
24-
* @var \Magento\Framework\ObjectManagerInterface|\PHPUnit_Framework_MockObject_MockObject
25-
*/
19+
/** @var \Magento\Framework\ObjectManagerInterface|\PHPUnit_Framework_MockObject_MockObject */
2620
private $objectManager;
2721

28-
/**
29-
* @var DiCompileCommand
30-
*/
22+
/** @var DiCompileCommand|\PHPUnit_Framework_MockObject_MockObject */
3123
private $command;
3224

25+
/** @var \Magento\Framework\App\Cache|\PHPUnit_Framework_MockObject_MockObject */
26+
private $cacheMock;
27+
28+
/** @var \Magento\Framework\Filesystem|\PHPUnit_Framework_MockObject_MockObject */
29+
private $filesystem;
30+
3331
public function setUp()
3432
{
3533
$this->deploymentConfig = $this->getMock('Magento\Framework\App\DeploymentConfig', [], [], '', false);
@@ -46,15 +44,22 @@ public function setUp()
4644
'',
4745
false
4846
);
47+
$this->cacheMock = $this->getMockBuilder('Magento\Framework\App\Cache')
48+
->disableOriginalConstructor()
49+
->getMock();
50+
4951
$objectManagerProvider->expects($this->once())->method('get')->willReturn($this->objectManager);
5052
$this->manager = $this->getMock('Magento\Setup\Module\Di\App\Task\Manager', [], [], '', false);
5153
$directoryList = $this->getMock('Magento\Framework\App\Filesystem\DirectoryList', [], [], '', false);
54+
$this->filesystem = $this->getMockBuilder('Magento\Framework\Filesystem')->disableOriginalConstructor()->getMock();
55+
5256
$directoryList->expects($this->exactly(3))->method('getPath');
5357
$this->command = new DiCompileCommand(
5458
$this->deploymentConfig,
5559
$directoryList,
5660
$this->manager,
57-
$objectManagerProvider
61+
$objectManagerProvider,
62+
$this->filesystem
5863
);
5964
}
6065

@@ -71,6 +76,15 @@ public function testExecuteNotInstalled()
7176

7277
public function testExecute()
7378
{
79+
$this->objectManager->expects($this->once())
80+
->method('get')
81+
->with('Magento\Framework\App\Cache')
82+
->willReturn($this->cacheMock);
83+
$this->cacheMock->expects($this->once())->method('clean');
84+
$writeDirectory = $this->getMock('Magento\Framework\Filesystem\Directory\WriteInterface');
85+
$writeDirectory->expects($this->atLeastOnce())->method('delete');
86+
$this->filesystem->expects($this->atLeastOnce())->method('getDirectoryWrite')->willReturn($writeDirectory);
87+
7488
$this->deploymentConfig->expects($this->once())->method('isAvailable')->willReturn(true);
7589
$this->objectManager->expects($this->once())->method('configure');
7690
$this->manager->expects($this->exactly(6))->method('addOperation');

0 commit comments

Comments
 (0)