2222use FastForward \DevTools \Console \Command \GitHooksCommand ;
2323use FastForward \DevTools \Filesystem \FinderFactoryInterface ;
2424use FastForward \DevTools \Filesystem \FilesystemInterface ;
25- use FastForward \DevTools \Process \ProcessBuilder ;
26- use FastForward \DevTools \Process \ProcessQueueInterface ;
2725use PHPUnit \Framework \Attributes \CoversClass ;
2826use PHPUnit \Framework \Attributes \Test ;
29- use PHPUnit \Framework \Attributes \UsesClass ;
3027use PHPUnit \Framework \TestCase ;
3128use Prophecy \Argument ;
3229use Prophecy \PhpUnit \ProphecyTrait ;
3633use Symfony \Component \Console \Input \InputInterface ;
3734use Symfony \Component \Console \Output \OutputInterface ;
3835use Symfony \Component \Finder \Finder ;
39- use Symfony \Component \Process \Process ;
4036
4137use function Safe \mkdir ;
4238use function Safe \file_put_contents ;
4339use function Safe \unlink ;
4440use function Safe \rmdir ;
4541
4642#[CoversClass(GitHooksCommand::class)]
47- #[UsesClass(ProcessBuilder::class)]
4843final class GitHooksCommandTest extends TestCase
4944{
5045 use ProphecyTrait;
@@ -55,8 +50,6 @@ final class GitHooksCommandTest extends TestCase
5550
5651 private ObjectProphecy $ finderFactory ;
5752
58- private ObjectProphecy $ processQueue ;
59-
6053 private ObjectProphecy $ input ;
6154
6255 private ObjectProphecy $ output ;
@@ -77,15 +70,12 @@ protected function setUp(): void
7770 $ this ->filesystem = $ this ->prophesize (FilesystemInterface::class);
7871 $ this ->fileLocator = $ this ->prophesize (FileLocatorInterface::class);
7972 $ this ->finderFactory = $ this ->prophesize (FinderFactoryInterface::class);
80- $ this ->processQueue = $ this ->prophesize (ProcessQueueInterface::class);
8173 $ this ->input = $ this ->prophesize (InputInterface::class);
8274 $ this ->output = $ this ->prophesize (OutputInterface::class);
8375
8476 $ this ->command = new GitHooksCommand (
8577 $ this ->filesystem ->reveal (),
8678 $ this ->fileLocator ->reveal (),
87- new ProcessBuilder (),
88- $ this ->processQueue ->reveal (),
8979 $ this ->finderFactory ->reveal (),
9080 );
9181 }
@@ -110,7 +100,7 @@ public function commandWillSetExpectedNameDescriptionAndHelp(): void
110100 self ::assertSame ('git-hooks ' , $ this ->command ->getName ());
111101 self ::assertSame ('Installs Fast Forward Git hooks. ' , $ this ->command ->getDescription ());
112102 self ::assertSame (
113- 'This command runs GrumPHP hook initialization and copies packaged Git hooks into the current repository. ' ,
103+ 'This command copies packaged Git hooks into the current repository. ' ,
114104 $ this ->command ->getHelp ()
115105 );
116106 }
@@ -119,23 +109,15 @@ public function commandWillSetExpectedNameDescriptionAndHelp(): void
119109 * @return void
120110 */
121111 #[Test]
122- public function executeWillRunGrumPhpInitAndCopyHooks (): void
112+ public function executeWillCopyPackagedHooks (): void
123113 {
124- $ this ->input ->getOption ('skip-grumphp-init ' )
125- ->willReturn (false );
126114 $ this ->input ->getOption ('source ' )
127115 ->willReturn ('resources/git-hooks ' );
128116 $ this ->input ->getOption ('target ' )
129117 ->willReturn ('.git/hooks ' );
130118 $ this ->input ->getOption ('no-overwrite ' )
131119 ->willReturn (false );
132120
133- $ this ->processQueue ->add (Argument::type (Process::class))
134- ->shouldBeCalledOnce ();
135- $ this ->processQueue ->run ($ this ->output ->reveal ())
136- ->willReturn (GitHooksCommand::SUCCESS )
137- ->shouldBeCalledOnce ();
138-
139121 $ this ->fileLocator ->locate ('resources/git-hooks ' )
140122 ->willReturn ($ this ->sourceDirectory );
141123 $ this ->finderFactory ->create ()
@@ -145,7 +127,7 @@ public function executeWillRunGrumPhpInitAndCopyHooks(): void
145127 ->willReturn ('/app/.git/hooks ' );
146128 $ this ->filesystem ->copy (Argument::containingString ('/post-merge ' ), '/app/.git/hooks/post-merge ' , true )
147129 ->shouldBeCalledOnce ();
148- $ this ->filesystem ->chmod ('/app/.git/hooks/post-merge ' , 0o755 , 0o755 )
130+ $ this ->filesystem ->chmod ('/app/.git/hooks/post-merge ' , 755 , 0o755 )
149131 ->shouldBeCalledOnce ();
150132
151133 self ::assertSame (GitHooksCommand::SUCCESS , $ this ->executeCommand ());
0 commit comments