BackupRollbackFactoryTest.php 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Framework\Setup\Test\Unit;
  7. use Magento\Framework\Setup\BackupRollbackFactory;
  8. class BackupRollbackFactoryTest extends \PHPUnit\Framework\TestCase
  9. {
  10. public function testCreate()
  11. {
  12. $objectManager = $this->getMockForAbstractClass(
  13. \Magento\Framework\ObjectManagerInterface::class,
  14. [],
  15. '',
  16. false
  17. );
  18. $consoleLogger = $this->createMock(\Magento\Framework\Setup\ConsoleLogger::class);
  19. $factory = $this->createMock(\Magento\Framework\Setup\BackupRollback::class);
  20. $output = $this->getMockForAbstractClass(
  21. \Symfony\Component\Console\Output\OutputInterface::class,
  22. [],
  23. '',
  24. false
  25. );
  26. $objectManager->expects($this->exactly(2))
  27. ->method('create')
  28. ->will($this->returnValueMap([
  29. [\Magento\Framework\Setup\ConsoleLogger::class, ['output' => $output], $consoleLogger],
  30. [\Magento\Framework\Setup\BackupRollback::class, ['log' => $consoleLogger], $factory],
  31. ]));
  32. $model = new BackupRollbackFactory($objectManager);
  33. $this->assertInstanceOf(\Magento\Framework\Setup\BackupRollback::class, $model->create($output));
  34. }
  35. }