@@ -56,16 +56,16 @@ |
||
| 56 | 56 | ); |
| 57 | 57 | |
| 58 | 58 | $io = $this->getMockBuilder(DefaultIO::class) |
| 59 | - ->disableOriginalConstructor() |
|
| 60 | - ->getMock(); |
|
| 59 | + ->disableOriginalConstructor() |
|
| 60 | + ->getMock(); |
|
| 61 | 61 | |
| 62 | 62 | $invokedCount = $this->atLeast(2); |
| 63 | 63 | $io->expects($invokedCount) |
| 64 | - ->method('ask') |
|
| 65 | - ->willReturnCallback(function ($parameters) use ($invokedCount) { |
|
| 66 | - $results = ['\\Foo\\Bar', 'n']; |
|
| 67 | - return $results[$invokedCount->numberOfInvocations() - 1] ?? ''; |
|
| 68 | - }); |
|
| 64 | + ->method('ask') |
|
| 65 | + ->willReturnCallback(function ($parameters) use ($invokedCount) { |
|
| 66 | + $results = ['\\Foo\\Bar', 'n']; |
|
| 67 | + return $results[$invokedCount->numberOfInvocations() - 1] ?? ''; |
|
| 68 | + }); |
|
| 69 | 69 | |
| 70 | 70 | $io->expects($this->once())->method('write'); |
| 71 | 71 | |
@@ -62,7 +62,7 @@ |
||
| 62 | 62 | $invokedCount = $this->atLeast(2); |
| 63 | 63 | $io->expects($invokedCount) |
| 64 | 64 | ->method('ask') |
| 65 | - ->willReturnCallback(function ($parameters) use ($invokedCount) { |
|
| 65 | + ->willReturnCallback(function($parameters) use ($invokedCount) { |
|
| 66 | 66 | $results = ['\\Foo\\Bar', 'n']; |
| 67 | 67 | return $results[$invokedCount->numberOfInvocations() - 1] ?? ''; |
| 68 | 68 | }); |
@@ -41,7 +41,7 @@ |
||
| 41 | 41 | |
| 42 | 42 | public function testUninstallPreCommitHook(): void |
| 43 | 43 | { |
| 44 | - $repo = new DummyRepo([ |
|
| 44 | + $repo = new DummyRepo([ |
|
| 45 | 45 | 'config' => '# fake git config', |
| 46 | 46 | 'hooks' => [ |
| 47 | 47 | 'pre-commit' => '# fake pre-commit hook file', |
@@ -42,8 +42,8 @@ |
||
| 42 | 42 | $config = '/foo/bar/fiz/baz/config.json'; |
| 43 | 43 | $input = new ArrayInput(['--configuration' => $config]); |
| 44 | 44 | $output = $this->getMockBuilder(OutputInterface::class) |
| 45 | - ->disableOriginalConstructor() |
|
| 46 | - ->getMock(); |
|
| 45 | + ->disableOriginalConstructor() |
|
| 46 | + ->getMock(); |
|
| 47 | 47 | $output->method('isVerbose')->willReturn(true); |
| 48 | 48 | |
| 49 | 49 | $configure = new Configuration($resolver); |
@@ -48,7 +48,7 @@ |
||
| 48 | 48 | |
| 49 | 49 | public function testFormatHeadlineShort(): void |
| 50 | 50 | { |
| 51 | - $text = str_repeat('x', 70) ; |
|
| 51 | + $text = str_repeat('x', 70); |
|
| 52 | 52 | $expected = '==== ' . $text . ' ===='; |
| 53 | 53 | $headline = IOUtil::formatHeadline($text, 80); |
| 54 | 54 | |
@@ -176,8 +176,8 @@ discard block |
||
| 176 | 176 | |
| 177 | 177 | $runner = new Uninstaller($io, $config, $repo); |
| 178 | 178 | $runner->setHook('post-merge') |
| 179 | - ->setMoveExistingTo('foo/bar/') |
|
| 180 | - ->run(); |
|
| 179 | + ->setMoveExistingTo('foo/bar/') |
|
| 180 | + ->run(); |
|
| 181 | 181 | |
| 182 | 182 | $this->assertFileDoesNotExist($fakeRepo->getHookDir() . '/post-merge'); |
| 183 | 183 | $this->assertFileExists($fakeRepo->getRoot() . '/foo/bar/post-merge'); |
@@ -208,8 +208,8 @@ discard block |
||
| 208 | 208 | |
| 209 | 209 | $runner = new Uninstaller($io, $config, $repo); |
| 210 | 210 | $runner->setHook('pre-commit') |
| 211 | - ->setMoveExistingTo('foo') |
|
| 212 | - ->run(); |
|
| 211 | + ->setMoveExistingTo('foo') |
|
| 212 | + ->run(); |
|
| 213 | 213 | } |
| 214 | 214 | |
| 215 | 215 | public function testMoveExistingHookWhenMoveExistingIsAnAbsolutePath(): void |
@@ -237,8 +237,8 @@ discard block |
||
| 237 | 237 | |
| 238 | 238 | $runner = new Uninstaller($io, $config, $repo); |
| 239 | 239 | $runner->setHook('pre-commit') |
| 240 | - ->setMoveExistingTo($virtualFs->url() . '/foo/bar') |
|
| 241 | - ->run(); |
|
| 240 | + ->setMoveExistingTo($virtualFs->url() . '/foo/bar') |
|
| 241 | + ->run(); |
|
| 242 | 242 | |
| 243 | 243 | $this->assertFileDoesNotExist($fakeRepo->getHookDir() . '/pre-commit'); |
| 244 | 244 | $this->assertFileExists($fakeRepo->getRoot() . '/foo/bar/pre-commit'); |
@@ -33,8 +33,8 @@ discard block |
||
| 33 | 33 | |
| 34 | 34 | $runner = new Editor($io, $config); |
| 35 | 35 | $runner->setHook('foo') |
| 36 | - ->setChange('EnableHook') |
|
| 37 | - ->run(); |
|
| 36 | + ->setChange('EnableHook') |
|
| 37 | + ->run(); |
|
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | public function testNoHook(): void |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | |
| 48 | 48 | $runner = new Editor($io, $config); |
| 49 | 49 | $runner->setChange('EnableHook') |
| 50 | - ->run(); |
|
| 50 | + ->run(); |
|
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | public function testNoChange(): void |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | |
| 61 | 61 | $runner = new Editor($io, $config); |
| 62 | 62 | $runner->setHook('pre-commit') |
| 63 | - ->run(); |
|
| 63 | + ->run(); |
|
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | public function testInvalidChange(): void |
@@ -73,8 +73,8 @@ discard block |
||
| 73 | 73 | |
| 74 | 74 | $runner = new Editor($io, $config); |
| 75 | 75 | $runner->setChange('InvalidChange') |
| 76 | - ->setHook('pre-commit') |
|
| 77 | - ->run(); |
|
| 76 | + ->setHook('pre-commit') |
|
| 77 | + ->run(); |
|
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | public function testMissingHook(): void |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | |
| 88 | 88 | $runner = new Editor($io, $config); |
| 89 | 89 | $runner->setChange('EnableHook') |
| 90 | - ->run(); |
|
| 90 | + ->run(); |
|
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | public function testMissingChange(): void |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | |
| 101 | 101 | $runner = new Editor($io, $config); |
| 102 | 102 | $runner->setHook('pre-commit') |
| 103 | - ->run(); |
|
| 103 | + ->run(); |
|
| 104 | 104 | } |
| 105 | 105 | |
| 106 | 106 | public function testNoConfiguration() |
@@ -113,8 +113,8 @@ discard block |
||
| 113 | 113 | |
| 114 | 114 | $runner = new Editor($io, $config); |
| 115 | 115 | $runner->setChange('AddAction') |
| 116 | - ->setHook('pre-commit') |
|
| 117 | - ->run(); |
|
| 116 | + ->setHook('pre-commit') |
|
| 117 | + ->run(); |
|
| 118 | 118 | } |
| 119 | 119 | |
| 120 | 120 | public function testConfigureFileExtend() |
@@ -125,17 +125,17 @@ discard block |
||
| 125 | 125 | $config = $this->createConfigMock(true, $configDir->url() . '/captainhook.json'); |
| 126 | 126 | $config->method('getHookConfig')->willReturn($this->createHookConfigMock()); |
| 127 | 127 | $io->expects($invocations) |
| 128 | - ->method('ask') |
|
| 129 | - ->willReturnCallback(function ($parameters) use ($invocations) { |
|
| 130 | - $results = ['y', 'y', '\\Foo\\Bar', 'y', 'foo:bar', 'n', 'n', 'n', 'n', 'n', 'n', 'n', 'n', 'n', 'n']; |
|
| 131 | - return $results[$invocations->numberOfInvocations() - 1] ?? ''; |
|
| 132 | - }); |
|
| 128 | + ->method('ask') |
|
| 129 | + ->willReturnCallback(function ($parameters) use ($invocations) { |
|
| 130 | + $results = ['y', 'y', '\\Foo\\Bar', 'y', 'foo:bar', 'n', 'n', 'n', 'n', 'n', 'n', 'n', 'n', 'n', 'n']; |
|
| 131 | + return $results[$invocations->numberOfInvocations() - 1] ?? ''; |
|
| 132 | + }); |
|
| 133 | 133 | $io->expects($this->once())->method('askAndValidate')->willReturn('foo:bar'); |
| 134 | 134 | |
| 135 | 135 | $runner = new Creator($io, $config); |
| 136 | 136 | $runner->extend(true) |
| 137 | - ->advanced(true) |
|
| 138 | - ->run(); |
|
| 137 | + ->advanced(true) |
|
| 138 | + ->run(); |
|
| 139 | 139 | |
| 140 | 140 | $this->assertFileExists($configDir->url() . '/captainhook.json'); |
| 141 | 141 | } |
@@ -126,7 +126,7 @@ |
||
| 126 | 126 | $config->method('getHookConfig')->willReturn($this->createHookConfigMock()); |
| 127 | 127 | $io->expects($invocations) |
| 128 | 128 | ->method('ask') |
| 129 | - ->willReturnCallback(function ($parameters) use ($invocations) { |
|
| 129 | + ->willReturnCallback(function($parameters) use ($invocations) { |
|
| 130 | 130 | $results = ['y', 'y', '\\Foo\\Bar', 'y', 'foo:bar', 'n', 'n', 'n', 'n', 'n', 'n', 'n', 'n', 'n', 'n']; |
| 131 | 131 | return $results[$invocations->numberOfInvocations() - 1] ?? ''; |
| 132 | 132 | }); |
@@ -29,11 +29,11 @@ |
||
| 29 | 29 | $config = $this->createConfigMock(); |
| 30 | 30 | $config->expects($this->exactly(2))->method('getHookConfig')->willReturn($this->createHookConfigMock()); |
| 31 | 31 | $io->expects($invokedCount) |
| 32 | - ->method('ask') |
|
| 33 | - ->willReturnCallback(function ($parameters) use ($invokedCount) { |
|
| 34 | - $results = ['y', 'y', 'y', 'phpunit', 'y', 'phpcs']; |
|
| 35 | - return $results[$invokedCount->numberOfInvocations() - 1] ?? ''; |
|
| 36 | - }); |
|
| 32 | + ->method('ask') |
|
| 33 | + ->willReturnCallback(function ($parameters) use ($invokedCount) { |
|
| 34 | + $results = ['y', 'y', 'y', 'phpunit', 'y', 'phpcs']; |
|
| 35 | + return $results[$invokedCount->numberOfInvocations() - 1] ?? ''; |
|
| 36 | + }); |
|
| 37 | 37 | |
| 38 | 38 | $setup = new Express($io); |
| 39 | 39 | $setup->configureHooks($config); |
@@ -30,12 +30,12 @@ |
||
| 30 | 30 | $config->expects($this->exactly(2))->method('getHookConfig')->willReturn($this->createHookConfigMock()); |
| 31 | 31 | $io->expects($invokedCount) |
| 32 | 32 | ->method('ask') |
| 33 | - ->willReturnCallback(function ($parameters) use ($invokedCount) { |
|
| 33 | + ->willReturnCallback(function($parameters) use ($invokedCount) { |
|
| 34 | 34 | $results = ['y', 'y', 'y', 'phpunit', 'y', 'phpcs']; |
| 35 | 35 | return $results[$invokedCount->numberOfInvocations() - 1] ?? ''; |
| 36 | 36 | }); |
| 37 | 37 | |
| 38 | - $setup = new Express($io); |
|
| 38 | + $setup = new Express($io); |
|
| 39 | 39 | $setup->configureHooks($config); |
| 40 | 40 | } |
| 41 | 41 | } |
@@ -29,11 +29,11 @@ discard block |
||
| 29 | 29 | $config = $this->createConfigMock(); |
| 30 | 30 | $config->expects($this->exactly(9))->method('getHookConfig')->willReturn($this->createHookConfigMock()); |
| 31 | 31 | $io->expects($invocations) |
| 32 | - ->method('ask') |
|
| 33 | - ->willReturnCallback(function ($parameters) use ($invocations) { |
|
| 34 | - $results = ['y', 'y', 'echo \'foo\'', 'n', 'n', 'n', 'n', 'n', 'n', 'n', 'n', 'n', 'n']; |
|
| 35 | - return $results[$invocations->numberOfInvocations() - 1] ?? ''; |
|
| 36 | - }); |
|
| 32 | + ->method('ask') |
|
| 33 | + ->willReturnCallback(function ($parameters) use ($invocations) { |
|
| 34 | + $results = ['y', 'y', 'echo \'foo\'', 'n', 'n', 'n', 'n', 'n', 'n', 'n', 'n', 'n', 'n']; |
|
| 35 | + return $results[$invocations->numberOfInvocations() - 1] ?? ''; |
|
| 36 | + }); |
|
| 37 | 37 | |
| 38 | 38 | $setup = new Advanced($io); |
| 39 | 39 | $setup->configureHooks($config); |
@@ -46,11 +46,11 @@ discard block |
||
| 46 | 46 | $config = $this->createConfigMock(); |
| 47 | 47 | $config->method('getHookConfig')->willReturn($this->createHookConfigMock()); |
| 48 | 48 | $io->expects($invocations) |
| 49 | - ->method('ask') |
|
| 50 | - ->willReturnCallback(function ($parameters) use ($invocations) { |
|
| 51 | - $results = ['y', 'y', '\\Foo\\Bar', 'y', 'foo:bar', 'n', 'n', 'n', 'n', 'n', 'n', 'n', 'n', 'n', 'n']; |
|
| 52 | - return $results[$invocations->numberOfInvocations() - 1] ?? ''; |
|
| 53 | - }); |
|
| 49 | + ->method('ask') |
|
| 50 | + ->willReturnCallback(function ($parameters) use ($invocations) { |
|
| 51 | + $results = ['y', 'y', '\\Foo\\Bar', 'y', 'foo:bar', 'n', 'n', 'n', 'n', 'n', 'n', 'n', 'n', 'n', 'n']; |
|
| 52 | + return $results[$invocations->numberOfInvocations() - 1] ?? ''; |
|
| 53 | + }); |
|
| 54 | 54 | |
| 55 | 55 | $io->expects($this->once())->method('askAndValidate')->willReturn('foo:bar'); |
| 56 | 56 | |
@@ -30,12 +30,12 @@ discard block |
||
| 30 | 30 | $config->expects($this->exactly(9))->method('getHookConfig')->willReturn($this->createHookConfigMock()); |
| 31 | 31 | $io->expects($invocations) |
| 32 | 32 | ->method('ask') |
| 33 | - ->willReturnCallback(function ($parameters) use ($invocations) { |
|
| 33 | + ->willReturnCallback(function($parameters) use ($invocations) { |
|
| 34 | 34 | $results = ['y', 'y', 'echo \'foo\'', 'n', 'n', 'n', 'n', 'n', 'n', 'n', 'n', 'n', 'n']; |
| 35 | 35 | return $results[$invocations->numberOfInvocations() - 1] ?? ''; |
| 36 | 36 | }); |
| 37 | 37 | |
| 38 | - $setup = new Advanced($io); |
|
| 38 | + $setup = new Advanced($io); |
|
| 39 | 39 | $setup->configureHooks($config); |
| 40 | 40 | } |
| 41 | 41 | |
@@ -47,14 +47,14 @@ discard block |
||
| 47 | 47 | $config->method('getHookConfig')->willReturn($this->createHookConfigMock()); |
| 48 | 48 | $io->expects($invocations) |
| 49 | 49 | ->method('ask') |
| 50 | - ->willReturnCallback(function ($parameters) use ($invocations) { |
|
| 50 | + ->willReturnCallback(function($parameters) use ($invocations) { |
|
| 51 | 51 | $results = ['y', 'y', '\\Foo\\Bar', 'y', 'foo:bar', 'n', 'n', 'n', 'n', 'n', 'n', 'n', 'n', 'n', 'n']; |
| 52 | 52 | return $results[$invocations->numberOfInvocations() - 1] ?? ''; |
| 53 | 53 | }); |
| 54 | 54 | |
| 55 | 55 | $io->expects($this->once())->method('askAndValidate')->willReturn('foo:bar'); |
| 56 | 56 | |
| 57 | - $setup = new Advanced($io); |
|
| 57 | + $setup = new Advanced($io); |
|
| 58 | 58 | $setup->configureHooks($config); |
| 59 | 59 | } |
| 60 | 60 | } |
@@ -33,15 +33,15 @@ discard block |
||
| 33 | 33 | $config = $this->createConfigMock(true); |
| 34 | 34 | $io = $this->createIOMock(); |
| 35 | 35 | $io->expects($invocations) |
| 36 | - ->method('ask') |
|
| 37 | - ->willReturnCallback(function ($parameters) use ($invocations) { |
|
| 38 | - $results = ['y', 'y', '\\Foo\\Bar', 'y', 'foo:bar', 'n', 'n', 'n', 'n', 'n', 'n', 'n', 'n', 'n', 'n']; |
|
| 39 | - return $results[$invocations->numberOfInvocations() - 1] ?? ''; |
|
| 40 | - }); |
|
| 36 | + ->method('ask') |
|
| 37 | + ->willReturnCallback(function ($parameters) use ($invocations) { |
|
| 38 | + $results = ['y', 'y', '\\Foo\\Bar', 'y', 'foo:bar', 'n', 'n', 'n', 'n', 'n', 'n', 'n', 'n', 'n', 'n']; |
|
| 39 | + return $results[$invocations->numberOfInvocations() - 1] ?? ''; |
|
| 40 | + }); |
|
| 41 | 41 | |
| 42 | 42 | $runner = new Creator($io, $config); |
| 43 | 43 | $runner->advanced(true) |
| 44 | - ->run(); |
|
| 44 | + ->run(); |
|
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | /** |
@@ -61,17 +61,17 @@ discard block |
||
| 61 | 61 | |
| 62 | 62 | $io = $this->createIOMock(); |
| 63 | 63 | $io->expects($invocations) |
| 64 | - ->method('ask') |
|
| 65 | - ->willReturnCallback(function ($parameters) use ($invocations) { |
|
| 66 | - $results = ['y', 'y', '\\Foo\\Bar', 'y', 'foo:bar', 'n', 'n', 'n', 'n', 'n', 'n', 'n', 'n', 'n', 'n']; |
|
| 67 | - return $results[$invocations->numberOfInvocations() - 1] ?? ''; |
|
| 68 | - }); |
|
| 64 | + ->method('ask') |
|
| 65 | + ->willReturnCallback(function ($parameters) use ($invocations) { |
|
| 66 | + $results = ['y', 'y', '\\Foo\\Bar', 'y', 'foo:bar', 'n', 'n', 'n', 'n', 'n', 'n', 'n', 'n', 'n', 'n']; |
|
| 67 | + return $results[$invocations->numberOfInvocations() - 1] ?? ''; |
|
| 68 | + }); |
|
| 69 | 69 | $io->expects($this->once())->method('askAndValidate')->willReturn('foo:bar'); |
| 70 | 70 | |
| 71 | 71 | $runner = new Creator($io, $config); |
| 72 | 72 | $runner->extend(true) |
| 73 | - ->advanced(true) |
|
| 74 | - ->run(); |
|
| 73 | + ->advanced(true) |
|
| 74 | + ->run(); |
|
| 75 | 75 | |
| 76 | 76 | $configFileContentAfter = $configDir->getChild('captainhook.json')->getContent(); |
| 77 | 77 | $this->assertFileExists($configFile); |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | $io = $this->createIOMock(); |
| 35 | 35 | $io->expects($invocations) |
| 36 | 36 | ->method('ask') |
| 37 | - ->willReturnCallback(function ($parameters) use ($invocations) { |
|
| 37 | + ->willReturnCallback(function($parameters) use ($invocations) { |
|
| 38 | 38 | $results = ['y', 'y', '\\Foo\\Bar', 'y', 'foo:bar', 'n', 'n', 'n', 'n', 'n', 'n', 'n', 'n', 'n', 'n']; |
| 39 | 39 | return $results[$invocations->numberOfInvocations() - 1] ?? ''; |
| 40 | 40 | }); |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | $io = $this->createIOMock(); |
| 63 | 63 | $io->expects($invocations) |
| 64 | 64 | ->method('ask') |
| 65 | - ->willReturnCallback(function ($parameters) use ($invocations) { |
|
| 65 | + ->willReturnCallback(function($parameters) use ($invocations) { |
|
| 66 | 66 | $results = ['y', 'y', '\\Foo\\Bar', 'y', 'foo:bar', 'n', 'n', 'n', 'n', 'n', 'n', 'n', 'n', 'n', 'n']; |
| 67 | 67 | return $results[$invocations->numberOfInvocations() - 1] ?? ''; |
| 68 | 68 | }); |