15 use Zend\ServiceManager\ServiceLocatorInterface;
25 private $objectManagerProviderMock;
27 public function testCreate()
29 $this->objectManagerProviderMock = $this->getMockBuilder(\
Magento\
Setup\Model\ObjectManagerProvider::class)
30 ->disableOriginalConstructor()
34 $objectManagerMock = $this->getMockBuilder(ObjectManager::class)
35 ->disableOriginalConstructor()
38 $objectManagerMock->expects($this->any())
42 [DeclarationInstaller::class, $this->createMock(DeclarationInstaller::class)],
43 [SchemaPersistor::class, $this->createMock(SchemaPersistor::class)],
46 $this->objectManagerProviderMock->expects($this->any())
48 ->willReturn($objectManagerMock);
50 $serviceLocatorMock = $this->getMockForAbstractClass(
51 ServiceLocatorInterface::class,
54 $serviceLocatorMock->expects($this->any())->method(
'get')
55 ->will($this->returnValueMap($this->getReturnValueMap()));
58 $log = $this->getMockForAbstractClass(LoggerInterface::class);
60 $resourceFactoryMock = $this->createMock(ResourceFactory::class);
62 ->expects($this->any())
64 ->will($this->returnValue($this->createMock(\
Magento\Framework\
App\ResourceConnection::class)));
65 $installerFactory =
new InstallerFactory($serviceLocatorMock, $resourceFactoryMock);
73 private function getReturnValueMap()
77 \Magento\Framework\Setup\FilePermissions::class,
78 $this->createMock(\
Magento\Framework\
Setup\FilePermissions::class),
81 \Magento\Framework\App\DeploymentConfig\Writer::class,
85 \Magento\Framework\App\DeploymentConfig\Reader::class,
89 \Magento\Framework\App\DeploymentConfig::class,
90 $this->createMock(\
Magento\Framework\
App\DeploymentConfig::class),
93 \Magento\Framework\Module\ModuleList::class,
94 $this->createMock(\
Magento\Framework\
Module\ModuleList::class),
97 \Magento\Framework\Module\ModuleList\Loader::class,
101 \Magento\Setup\Model\AdminAccountFactory::class,
102 $this->createMock(\
Magento\
Setup\Model\AdminAccountFactory::class),
105 \Magento\Setup\Module\ConnectionFactory::class,
109 \Magento\Framework\App\MaintenanceMode::class,
110 $this->createMock(\
Magento\Framework\
App\MaintenanceMode::class),
113 \Magento\Framework\Filesystem::class,
114 $this->createMock(\
Magento\Framework\Filesystem::class),
117 \Magento\Setup\Model\ObjectManagerProvider::class,
118 $this->objectManagerProviderMock
121 \Magento\Framework\Model\ResourceModel\Db\TransactionManager::class,
125 \Magento\Framework\Model\ResourceModel\Db\ObjectRelationProcessor::class,
129 \Magento\Setup\Model\ConfigModel::class,
130 $this->createMock(\
Magento\
Setup\Model\ConfigModel::class),
133 \Magento\Framework\App\State\CleanupFiles::class,
137 \Magento\Setup\Validator\DbValidator::class,
141 \Magento\Setup\Module\SetupFactory::class,
145 \Magento\Setup\Module\DataSetupFactory::class,
149 \Magento\Framework\Setup\SampleData\State::class,
150 $this->createMock(\
Magento\Framework\
Setup\SampleData\State::class),
153 \Magento\Setup\Model\PhpReadinessCheck::class,
154 $this->createMock(\
Magento\
Setup\Model\PhpReadinessCheck::class),