19 private $objectManager;
49 private $moduleRegistryUninstaller;
54 private $patchApplierMock;
58 $this->moduleRegistryUninstaller = $this->createMock(\
Magento\
Setup\Model\ModuleRegistryUninstaller::class);
59 $this->objectManager = $this->getMockForAbstractClass(
60 \
Magento\Framework\ObjectManagerInterface::class,
65 $objectManagerProvider = $this->createMock(\
Magento\
Setup\Model\ObjectManagerProvider::class);
66 $objectManagerProvider->expects($this->once())->method(
'get')->willReturn($this->objectManager);
68 $this->
remove = $this->createMock(\
Magento\Framework\Composer\Remove::class);
69 $this->collector = $this->createMock(\
Magento\
Setup\Model\UninstallCollector::class);
72 $this->patchApplierMock = $this->createMock(PatchApplier::class);
74 $setupFactory->expects($this->any())->method(
'create')->willReturn($this->setup);
77 $objectManagerProvider,
81 $this->moduleRegistryUninstaller
84 $this->
output = $this->createMock(\Symfony\Component\Console\Output\OutputInterface::class);
89 $this->moduleRegistryUninstaller->expects($this->never())->method($this->anything());
90 $uninstall = $this->getMockForAbstractClass(\
Magento\Framework\
Setup\UninstallInterface::class, [],
'',
false);
91 $uninstall->expects($this->atLeastOnce())
93 ->with($this->setup, $this->isInstanceOf(\
Magento\
Setup\Model\ModuleContext::class));
94 $this->collector->expects($this->once())
95 ->method(
'collectUninstall')
96 ->willReturn([
'moduleA' => $uninstall,
'moduleB' => $uninstall]);
99 $resource->expects($this->atLeastOnce())->method(
'getDbVersion')->willReturn(
'1.0');
101 $this->
output->expects($this->atLeastOnce())->method(
'writeln');
103 $this->objectManager->expects($this->any())
108 [PatchApplier::class, $this->patchApplierMock]
111 $this->patchApplierMock->expects($this->exactly(2))->method(
'revertDataPatches')->willReturnMap(
117 $this->uninstaller->uninstallData($this->
output, [
'moduleA',
'moduleB']);
122 $this->moduleRegistryUninstaller->expects($this->never())->method($this->anything());
123 $this->
output->expects($this->once())->method(
'writeln');
124 $packageInfoFactory = $this->createMock(\
Magento\Framework\
Module\PackageInfoFactory::class);
125 $packageInfo = $this->createMock(\
Magento\Framework\
Module\PackageInfo::class);
126 $packageInfo->expects($this->atLeastOnce())->method(
'getPackageName');
127 $packageInfoFactory->expects($this->once())->method(
'create')->willReturn($packageInfo);
128 $this->objectManager->expects($this->once())
131 ->willReturn($packageInfoFactory);
132 $this->
remove->expects($this->once())->method(
'remove');
133 $this->uninstaller->uninstallCode($this->
output, [
'moduleA',
'moduleB']);
output($string, $level=INFO, $label='')
testUninstallRemoveData()
testUninstallRemoveCode()