@@ -63,7 +63,7 @@ public function testPatchesAreAppliedWhenPackageIsAddedToExistingProject()
6363 $ this ->assertThatComposerRunHasAppliedPatches ($ requireRun , self ::PACKAGEA_PATCH1_APPLICATIONS );
6464 }
6565
66- public function testThatPatchesAreNotReappliedOnUpdate ()
66+ public function testPatchesAreNotReappliedOnUpdate ()
6767 {
6868 $ project = $ this ->getSandbox ()->createProjectSandBox ('test/project-template ' , 'dev-master ' , [
6969 'require ' => [
@@ -83,7 +83,7 @@ public function testThatPatchesAreNotReappliedOnUpdate()
8383 $ this ->assertNotContains ('Applied patch ' , $ updateRun ->getFullOutput (), 'no patches were applied ' , true );
8484 }
8585
86- public function testThatLayeredPatchesAreAppliedInCorrectOrder ()
86+ public function testLayeredPatchesAreAppliedInCorrectOrder ()
8787 {
8888 $ project = $ this ->getSandbox ()->createProjectSandBox ('test/project-template ' , 'dev-master ' , [
8989 'require ' => [
@@ -108,7 +108,7 @@ public function testThatLayeredPatchesAreAppliedInCorrectOrder()
108108 $ this ->assertNotContains ('Applied patch ' , $ updateRun ->getFullOutput (), 'no patches were applied ' , true );
109109 }
110110
111- public function testThatPatchesAreDeduplicated ()
111+ public function testPatchesAreDeduplicated ()
112112 {
113113 // Same patch coming from multiple patchsets shall be applied only once
114114
@@ -130,4 +130,38 @@ public function testThatPatchesAreDeduplicated()
130130 )
131131 );
132132 }
133+
134+ public function testRemovingPatchsetWillRemovePatches ()
135+ {
136+ // Same patch coming from multiple patchsets shall be applied only once
137+
138+ $ project = $ this ->getSandbox ()->createProjectSandBox ('test/project-template ' , 'dev-master ' , [
139+ 'require ' => [
140+ 'test/patchset ' => '~1.0 ' ,
141+ 'test/patchset-extra ' => '~1.0 ' ,
142+ 'test/package-a ' => 'dev-master ' ,
143+ 'creativestyle/composer-plugin-patchset ' => 'dev-master '
144+ ]
145+ ]);
146+
147+ $ installRun = $ project ->runComposerCommand ('install ' );
148+
149+ $ this ->assertThatComposerRunHasAppliedPatches ($ installRun ,
150+ array_merge_recursive (
151+ self ::PACKAGEA_PATCH1_APPLICATIONS ,
152+ self ::PACKAGEA_PATCH2_APPLICATIONS
153+ )
154+ );
155+
156+ $ removeRun = $ project ->runComposerCommand ('remove ' , 'test/patchset-extra ' );
157+
158+ $ this ->assertContains ('Reinstalling test/package-a ' , $ removeRun ->getFullOutput (), 'test/package-a has been reinstalled ' , true );
159+
160+ // First patch is coming from the first patchset so it still should be applied
161+ $ this ->assertThatComposerRunHasAppliedPatches ($ removeRun ,
162+ self ::PACKAGEA_PATCH1_APPLICATIONS ,
163+ self ::PACKAGEA_PATCH2_APPLICATIONS
164+ );
165+
166+ }
133167}
0 commit comments