@@ -138,7 +138,7 @@ public function it_does_not_create_the_hook_lock_file_if_the_no_lock_option_is_p
138
138
$ currentDir = realpath (getcwd ());
139
139
$ this ->commandTester ->execute (['--no-lock ' => true ], ['verbosity ' => OutputInterface::VERBOSITY_VERBOSE ]);
140
140
141
- $ this ->assertContains ('Skipped creating a ' . $ currentDir . ' / ' . Hook::LOCK_FILE . ' file ' , $ this ->commandTester ->getDisplay ());
141
+ $ this ->assertContains ('Skipped creating a ' . Hook::LOCK_FILE . ' file ' , $ this ->commandTester ->getDisplay ());
142
142
$ this ->assertFileNotExists (Hook::LOCK_FILE );
143
143
}
144
144
@@ -150,7 +150,7 @@ public function it_does_not_ignore_the_hook_lock_file()
150
150
$ currentDir = realpath (getcwd ());
151
151
$ this ->commandTester ->execute ([], ['verbosity ' => OutputInterface::VERBOSITY_VERBOSE ]);
152
152
153
- $ this ->assertContains ('Skipped adding ' . $ currentDir . ' / ' . Hook::LOCK_FILE . ' to .gitignore ' , $ this ->commandTester ->getDisplay ());
153
+ $ this ->assertContains ('Skipped adding ' . Hook::LOCK_FILE . ' to .gitignore ' , $ this ->commandTester ->getDisplay ());
154
154
$ this ->assertFalse (strpos (file_get_contents ('.gitignore ' ), Hook::LOCK_FILE ));
155
155
}
156
156
@@ -165,6 +165,18 @@ public function it_ignores_the_hook_lock_file_if_the_ignore_lock_option_is_passe
165
165
$ this ->assertTrue (strpos (file_get_contents ('.gitignore ' ), Hook::LOCK_FILE ) !== false );
166
166
}
167
167
168
+ /**
169
+ * @test
170
+ */
171
+ public function it_does_not_ignore_the_hook_lock_file_if_it_is_already_ignored ()
172
+ {
173
+ file_put_contents ('.gitignore ' , Hook::LOCK_FILE . PHP_EOL , FILE_APPEND );
174
+ $ this ->commandTester ->execute (['--ignore-lock ' => true ], ['verbosity ' => OutputInterface::VERBOSITY_VERBOSE ]);
175
+
176
+ $ this ->assertNotContains ('Added ' . Hook::LOCK_FILE . ' to .gitignore ' , $ this ->commandTester ->getDisplay ());
177
+ $ this ->assertTrue (strpos (file_get_contents ('.gitignore ' ), Hook::LOCK_FILE ) !== false );
178
+ }
179
+
168
180
/**
169
181
* @test
170
182
*/
0 commit comments