BackupRollbackFactoryTest.php 1.34 KB
Newer Older
Ketan's avatar
Ketan committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
<?php
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */
namespace Magento\Framework\Setup\Test\Unit;

use Magento\Framework\Setup\BackupRollbackFactory;

class BackupRollbackFactoryTest extends \PHPUnit\Framework\TestCase
{
    public function testCreate()
    {
        $objectManager = $this->getMockForAbstractClass(
            \Magento\Framework\ObjectManagerInterface::class,
            [],
            '',
            false
        );
        $consoleLogger = $this->createMock(\Magento\Framework\Setup\ConsoleLogger::class);
        $factory = $this->createMock(\Magento\Framework\Setup\BackupRollback::class);
        $output = $this->getMockForAbstractClass(
            \Symfony\Component\Console\Output\OutputInterface::class,
            [],
            '',
            false
        );
        $objectManager->expects($this->exactly(2))
            ->method('create')
            ->will($this->returnValueMap([
                [\Magento\Framework\Setup\ConsoleLogger::class, ['output' => $output], $consoleLogger],
                [\Magento\Framework\Setup\BackupRollback::class, ['log' => $consoleLogger], $factory],
            ]));
        $model = new BackupRollbackFactory($objectManager);
        $this->assertInstanceOf(\Magento\Framework\Setup\BackupRollback::class, $model->create($output));
    }
}