20 private $adapterInterface;
29 $objectManagerProvider = $this->createMock(\
Magento\
Setup\Model\ObjectManagerProvider::class);
31 $this->getMockForAbstractClass(\
Magento\Framework\ObjectManagerInterface::class, [],
'',
false);
32 $objectManagerProvider->expects($this->once())->method(
'get')->willReturn(
$objectManager);
35 $this->adapterInterface = $this->getMockForAbstractClass(
36 \
Magento\Framework\DB\Adapter\AdapterInterface::class,
41 $select = $this->createPartialMock(\
Magento\Framework\DB\Select::class, [
'from']);
42 $this->adapterInterface->expects($this->once())->method(
'select')->willReturn(
$select);
43 $setup->expects($this->exactly(2))->method(
'getConnection')->willReturn($this->adapterInterface);
44 $this->result = $this->createMock(\
Magento\Framework\DB\Select::class);
45 $select->expects($this->once())->method(
'from')->willReturn($this->result);
47 $uninstallA =
'Uninstall Class A';
48 $uninstallB =
'Uninstall Class B';
52 $this->returnValueMap([
53 [
'Magento\A\Setup\Uninstall', [], $uninstallA],
54 [
'Magento\B\Setup\Uninstall', [], $uninstallB],
58 $setupFactory->expects($this->once())->method(
'create')->willReturn(
$setup);
65 $this->result->expects($this->never())->method(
'where');
66 $this->adapterInterface->expects($this->once())
69 ->willReturn([[
'module' =>
'Magento_A'], [
'module' =>
'Magento_B'], [
'module' =>
'Magento_C']]);
72 [
'Magento_A' =>
'Uninstall Class A',
'Magento_B' =>
'Uninstall Class B'],
73 $this->collector->collectUninstall()
79 $this->result->expects($this->once())->method(
'where')->willReturn($this->result);
80 $this->adapterInterface->expects($this->once())
83 ->willReturn([[
'module' =>
'Magento_A']]);
85 $this->assertEquals([
'Magento_A' =>
'Uninstall Class A'], $this->collector->collectUninstall([
'Magento_A']));
testUninstallCollectorWithInput()
is_subclass_of($obj, $className)