24 private $patchHistory;
29 private $resourceConnectionMock;
34 $this->resourceConnectionMock = $this->createMock(ResourceConnection::class);
38 'resourceConnection' => $this->resourceConnectionMock,
46 public function testFixPatch()
49 $patch1 = $this->createMock(PatchInterface::class);
51 $adapterMock = $this->createMock(AdapterInterface::class);
52 $this->resourceConnectionMock->expects($this->any())->method(
'getConnection')->willReturn($adapterMock);
53 $selectMock = $this->createMock(\
Magento\Framework\DB\Select::class);
54 $selectMock->expects($this->once())->method(
'from');
55 $adapterMock->expects($this->any())->method(
'select')->willReturn($selectMock);
56 $adapterMock->expects($this->once())->method(
'fetchCol')->willReturn([]);
57 $this->resourceConnectionMock->expects($this->any())
58 ->method(
'getTableName')
60 $adapterMock->expects($this->once())->method(
'insert')
62 $this->patchHistory->fixPatch(get_class($patch1));
69 public function testFixAppliedPatch()
72 $patch1 = $this->createMock(PatchInterface::class);
74 $adapterMock = $this->createMock(AdapterInterface::class);
75 $this->resourceConnectionMock->expects($this->any())->method(
'getConnection')->willReturn($adapterMock);
76 $selectMock = $this->createMock(\
Magento\Framework\DB\Select::class);
77 $selectMock->expects($this->once())->method(
'from');
78 $adapterMock->expects($this->any())->method(
'select')->willReturn($selectMock);
79 $adapterMock->expects($this->once())->method(
'fetchCol')->willReturn([get_class($patch1)]);
80 $this->resourceConnectionMock->expects($this->any())
81 ->method(
'getTableName')
83 $adapterMock->expects($this->never())->method(
'insert');
84 $this->patchHistory->fixPatch(get_class($patch1));