Skip to content

Commit dd77241

Browse files
committed
Resolves acquia#11: Preventing unit tests from creating new commits.
1 parent 28d4db0 commit dd77241

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

template/tests/phpunit/GitTest.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public function testGitPreCommitHook() {
6666
// Commits must be executed inside of new project directory.
6767
chdir($this->projectDirectory);
6868
$prefix = $this->config['project']['prefix'];
69-
$command = "git commit --amend -m '$prefix-123: This is a good commit.' 2>&1";
69+
$command = "git commit --amend -m '$prefix-123: This is a good commit.' 2>&1 && git reset HEAD~1";
7070
$output = shell_exec($command);
7171
$this->assertNotContains('PHP Code Sniffer was not found', $output);
7272
$this->assertContains('Sniffing staged files via PHP Code Sniffer.', $output);
@@ -87,7 +87,7 @@ protected function assertCommitMessageValidity($is_valid, $commit_message, $mess
8787
chdir($this->projectDirectory);
8888

8989
// "2>&1" redirects standard error output to standard output.
90-
$command = "git commit --amend -m '$commit_message' 2>&1";
90+
$command = "git commit --amend -m '$commit_message' 2>&1 && git reset HEAD~1";
9191
print "Executing \"$command\" \n";
9292

9393
$output = shell_exec($command);

0 commit comments

Comments
 (0)