Skip to content

Commit 08b8aee

Browse files
Add WSL template test
1 parent 9730cc7 commit 08b8aee

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

tests/unit/Hook/Template/BuilderTest.php

+19
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,25 @@ public function testBuildLocalTemplate(): void
110110
$this->assertStringContainsString('pre-commit', $code);
111111
$this->assertStringContainsString('$captainHook->run', $code);
112112
}
113+
/**
114+
* Tests Builder::build
115+
*/
116+
public function testBuildWSLTemplate(): void
117+
{
118+
$resolver = $this->createResolverMock(CH_PATH_FILES . '/bin/captainhook', false);
119+
$repository = $this->createRepositoryMock(CH_PATH_FILES);
120+
$config = $this->createConfigMock(true, CH_PATH_FILES . '/template/captainhook.json');
121+
$runConfig = new Run(['mode' => 'wsl', 'exec' => '', 'path' => '']);
122+
$config->method('getRunConfig')->willReturn($runConfig);
123+
$config->method('getBootstrap')->willReturn('vendor/autoload.php');
124+
125+
$template = Builder::build($config, $repository, $resolver);
126+
$this->assertInstanceOf(Local\WSL::class, $template);
127+
128+
$code = $template->getCode('pre-commit');
129+
$this->assertStringContainsString('pre-commit', $code);
130+
$this->assertStringContainsString('wsl.exe', $code);
131+
}
113132

114133
/**
115134
* Tests Builder::build

0 commit comments

Comments
 (0)