Skip to content

Commit e889730

Browse files
remicolletjrfnl
authored andcommitted
Tests/Filters: skip tests requiring git repository
1 parent 1703a6b commit e889730

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

tests/Core/Filters/GitModifiedTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,10 @@ public static function dataAcceptOnlyGitModified()
211211
*/
212212
public function testExecAlwaysReturnsArray($cmd, $expected)
213213
{
214+
if (is_dir(__DIR__.'/../../../.git') === false) {
215+
$this->markTestSkipped('Not a git repository');
216+
}
217+
214218
$fakeDI = new RecursiveArrayIterator(self::getFakeFileList());
215219
$filter = new GitModified($fakeDI, '/', self::$config, self::$ruleset);
216220

tests/Core/Filters/GitStagedTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,10 @@ public static function dataAcceptOnlyGitStaged()
211211
*/
212212
public function testExecAlwaysReturnsArray($cmd, $expected)
213213
{
214+
if (is_dir(__DIR__.'/../../../.git') === false) {
215+
$this->markTestSkipped('Not a git repository');
216+
}
217+
214218
$fakeDI = new RecursiveArrayIterator(self::getFakeFileList());
215219
$filter = new GitStaged($fakeDI, '/', self::$config, self::$ruleset);
216220

0 commit comments

Comments
 (0)