CommandListTest.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Deploy\Test\Unit\Console;
  7. use Magento\Deploy\Console\Command\App\ConfigImportCommand;
  8. use Magento\Deploy\Console\CommandList;
  9. use Magento\Framework\ObjectManagerInterface;
  10. use PHPUnit\Framework\TestCase;
  11. /**
  12. * @inheritdoc
  13. */
  14. class CommandListTest extends TestCase
  15. {
  16. /**
  17. * @var CommandList
  18. */
  19. private $model;
  20. /**
  21. * @var ObjectManagerInterface|\PHPUnit_Framework_MockObject_MockObject
  22. */
  23. private $objectManagerMock;
  24. /**
  25. * @inheritdoc
  26. */
  27. protected function setUp()
  28. {
  29. $this->objectManagerMock = $this->getMockBuilder(ObjectManagerInterface::class)
  30. ->getMockForAbstractClass();
  31. $this->model = new CommandList(
  32. $this->objectManagerMock
  33. );
  34. }
  35. public function testGetCommands()
  36. {
  37. $configImportCommand = $this->getMockBuilder(ConfigImportCommand::class)
  38. ->disableOriginalConstructor()
  39. ->getMock();
  40. $this->objectManagerMock->expects($this->once())
  41. ->method('get')
  42. ->willReturnMap([
  43. [ConfigImportCommand::class, $configImportCommand],
  44. ]);
  45. $this->assertSame(
  46. [$configImportCommand],
  47. $this->model->getCommands()
  48. );
  49. }
  50. }