1 | <?php |
||
5 | class GitProjectTest extends BaseProjectTest |
||
6 | { |
||
7 | public function testInstallation() |
||
8 | { |
||
9 | $this->assertCommandSuccessful('git init'); |
||
10 | $this->assertCommandSuccessful('git config user.email "[email protected]"'); |
||
11 | $this->assertCommandSuccessful('git config user.name "John Doe"'); |
||
12 | |||
13 | $this->assertNotFalse( |
||
14 | file_put_contents('.git/hooks/post-commit', 'echo "OK"'), |
||
15 | 'Create fake "old" hook.' |
||
16 | ); |
||
17 | |||
18 | $this->assertCommandSuccessful(self::getEbCmd() . 'install'); |
||
19 | |||
20 | $this->assertTrue( |
||
21 | file_exists('.git/hooks/pre-commit'), |
||
22 | 'Pre-commit hook was not installed successfully.' |
||
23 | ); |
||
24 | |||
25 | $this->assertTrue( |
||
26 | file_exists('.git/hooks/post-commit.bak'), |
||
27 | 'Ensure "old" hook has been backed up.' |
||
28 | ); |
||
29 | |||
30 | $config = sprintf( |
||
31 | '<%s return [%s => [%s]];', |
||
32 | '?php', |
||
33 | Event\Git::class . '::PRE_COMMIT', |
||
34 | sprintf( |
||
35 | 'new %s( %s::getAdded() )', |
||
36 | Action\PhpLinter::class, |
||
37 | Change\GitChangeSet::class |
||
38 | ) |
||
39 | ); |
||
40 | $this->assertNotFalse(file_put_contents('.brother.php', $config)); |
||
41 | } |
||
42 | |||
43 | /** |
||
44 | * @depends testInstallation |
||
45 | */ |
||
46 | public function testCommitingGoodCode() |
||
53 | |||
54 | /** |
||
55 | * @depends testCommitingGoodCode |
||
56 | */ |
||
57 | public function testCommitingBadCode() |
||
64 | |||
65 | /** |
||
66 | * @depends testCommitingGoodCode |
||
67 | * @depends testCommitingBadCode |
||
68 | */ |
||
69 | public function testUninstallation() |
||
83 | } |
||
84 |