@@ -278,4 +278,43 @@ public function testStatusApplied()
278278
279279 $ this ->assertSame (StatusPool::APPLIED , $ this ->applier ->status ($ patchContent ));
280280 }
281+
282+ /**
283+ * Tests checkApply operation.
284+ *
285+ * Verifies that 'diff --git' is replaced with 'diff -Nuar'
286+ */
287+ public function testCheckApply ()
288+ {
289+ $ patchContent = 'diff --git a/vendor/module-deploy/Queue.php b/vendor/module-deploy/Queue.php
290+ --- a/vendor/magento/module-deploy/Process/Queue.php
291+ +++ b/vendor/magento/module-deploy/Process/Queue.php
292+ diff --git a/vendor/magento/module-email/Model/Transport.php b/vendor/magento/module-email/Model/Transport.php
293+ --- a/vendor/magento/module-email/Model/Transport.php
294+ +++ b/vendor/magento/module-email/Model/Transport.php
295+ - echo "diff --git";
296+ + echo "diff --Nuar";
297+ diff -Nuar a/vendor/magento/module-email/Model/Transport.php b/vendor/magento/module-email/Model/Transport.php
298+ ' ;
299+ $ expectedPatchContent = 'diff -Nuar a/vendor/module-deploy/Queue.php b/vendor/module-deploy/Queue.php
300+ --- a/vendor/magento/module-deploy/Process/Queue.php
301+ +++ b/vendor/magento/module-deploy/Process/Queue.php
302+ diff -Nuar a/vendor/magento/module-email/Model/Transport.php b/vendor/magento/module-email/Model/Transport.php
303+ --- a/vendor/magento/module-email/Model/Transport.php
304+ +++ b/vendor/magento/module-email/Model/Transport.php
305+ - echo "diff --git";
306+ + echo "diff --Nuar";
307+ diff -Nuar a/vendor/magento/module-email/Model/Transport.php b/vendor/magento/module-email/Model/Transport.php
308+ ' ;
309+
310+ $ this ->magentoVersion ->expects ($ this ->once ())
311+ ->method ('isGitBased ' )
312+ ->willReturn (false );
313+
314+ $ this ->patchCommand ->expects ($ this ->once ())
315+ ->method ('applyCheck ' )
316+ ->with ($ expectedPatchContent );
317+
318+ $ this ->assertTrue ($ this ->applier ->checkApply ($ patchContent ));
319+ }
281320}
0 commit comments