7
7
namespace Magento \Framework \App \Test \Unit \Console ;
8
8
9
9
use Magento \Framework \Console \CommandList ;
10
+ use Symfony \Component \Console \Command \Command ;
10
11
11
12
class CommandListTest extends \PHPUnit_Framework_TestCase
12
13
{
@@ -16,36 +17,24 @@ class CommandListTest extends \PHPUnit_Framework_TestCase
16
17
private $ commandList ;
17
18
18
19
/**
19
- * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\ObjectManagerInterface
20
+ * @var Symfony\Component\Console\Command\Command
20
21
*/
21
- private $ objectManager ;
22
+ private $ testCommand ;
22
23
23
24
public function setUp ()
24
25
{
25
- $ commands =[
26
- 'Symfony\Component\Console\Command\Command '
26
+ $ this ->testCommand = new Command ('Test ' );
27
+ $ commands = [
28
+ $ this ->testCommand
27
29
];
28
30
29
- $ this ->objectManager = $ this ->getMock ('Magento\Framework\ObjectManagerInterface ' , [], [], '' , false );
30
- $ this ->commandList = new CommandList ($ this ->objectManager , $ commands );
31
+ $ this ->commandList = new CommandList ($ commands );
31
32
}
32
33
33
34
public function testGetCommands ()
34
35
{
35
- $ this ->objectManager ->expects ($ this ->once ())->method ('get ' )->with ('Symfony\Component\Console\Command\Command ' );
36
- $ this ->commandList ->getCommands ();
37
- }
38
-
39
- /**
40
- * @expectedException \Exception
41
- * @expectedExceptionMessage Class Symfony\Component\Console\Command\WrongCommand does not exist
42
- */
43
- public function testGetCommandsException ()
44
- {
45
- $ wrongCommands =[
46
- 'Symfony\Component\Console\Command\WrongCommand '
47
- ];
48
- $ commandList = new CommandList ($ this ->objectManager , $ wrongCommands );
49
- $ commandList ->getCommands ();
36
+ $ commands = $ this ->commandList ->getCommands ();
37
+ $ this ->assertEquals (1 , count ($ commands ));
38
+ $ this ->assertEquals ($ this ->testCommand , $ commands [0 ]);
50
39
}
51
40
}
0 commit comments