File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed
lib/internal/Magento/Framework/Setup/Test/Unit/Patch Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -83,4 +83,28 @@ public function testFixAppliedPatch()
83
83
$ adapterMock ->expects ($ this ->never ())->method ('insert ' );
84
84
$ this ->patchHistory ->fixPatch (get_class ($ patch1 ));
85
85
}
86
+
87
+ /**
88
+ * @expectedException \LogicException
89
+ * @expectedExceptionMessageRegExp "Patch [a-zA-Z0-9\_]+ cannot be applied twice"
90
+ */
91
+ public function testFixPatchTwice ()
92
+ {
93
+ /** @var PatchInterface|\PHPUnit_Framework_MockObject_MockObject $patch1 */
94
+ $ patch = $ this ->createMock (PatchInterface::class);
95
+ /** @var AdapterInterface|\PHPUnit_Framework_MockObject_MockObject $adapterMock */
96
+ $ adapterMock = $ this ->createMock (AdapterInterface::class);
97
+ $ this ->resourceConnectionMock ->expects ($ this ->any ())->method ('getConnection ' )->willReturn ($ adapterMock );
98
+ $ this ->resourceConnectionMock ->expects ($ this ->any ())
99
+ ->method ('getTableName ' )
100
+ ->willReturn (PatchHistory::TABLE_NAME );
101
+ $ selectMock = $ this ->createMock (\Magento \Framework \DB \Select::class);
102
+ $ selectMock ->expects ($ this ->once ())->method ('from ' );
103
+ $ adapterMock ->expects ($ this ->any ())->method ('select ' )->willReturn ($ selectMock );
104
+ $ adapterMock ->expects ($ this ->once ())->method ('fetchCol ' )->willReturn ([]);
105
+ $ adapterMock ->expects ($ this ->once ())->method ('insert ' );
106
+
107
+ $ this ->patchHistory ->fixPatch (get_class ($ patch ));
108
+ $ this ->patchHistory ->fixPatch (get_class ($ patch ));
109
+ }
86
110
}
You can’t perform that action at this time.
0 commit comments