RemoveTest.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Framework\Composer;
  7. use Magento\Composer\MagentoComposerApplication;
  8. class RemoveTest extends \PHPUnit\Framework\TestCase
  9. {
  10. public function testRemove()
  11. {
  12. $composerAppFactory = $this->getMockBuilder(MagentoComposerApplicationFactory::class)
  13. ->disableOriginalConstructor()
  14. ->getMock();
  15. $composerApp = $this->getMockBuilder(MagentoComposerApplication::class)
  16. ->disableOriginalConstructor()
  17. ->getMock();
  18. $composerApp->expects($this->once())
  19. ->method('runComposerCommand')
  20. ->with(
  21. [
  22. 'command' => 'remove',
  23. 'packages' => ['magento/package-a', 'magento/package-b'],
  24. '--no-update-with-dependencies' => true,
  25. ]
  26. );
  27. $composerAppFactory->expects($this->once())
  28. ->method('create')
  29. ->willReturn($composerApp);
  30. $remove = new Remove($composerAppFactory);
  31. $remove->remove(['magento/package-a', 'magento/package-b']);
  32. }
  33. }