summaryrefslogtreecommitdiffstats
path: root/0001-skip-tests-requiring-git-repository.patch
blob: d79dbd54be1fe93009ca55772e428c49c3c391de (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
From 472b4f7c56dd95ca4469ed5aad6d6620aa13e03e Mon Sep 17 00:00:00 2001
From: Remi Collet <remi@remirepo.net>
Date: Fri, 12 Jan 2024 08:25:58 +0100
Subject: [PATCH] skip tests requiring git repository

---
 tests/Core/Filters/GitModifiedTest.php | 3 +++
 tests/Core/Filters/GitStagedTest.php   | 3 +++
 2 files changed, 6 insertions(+)

diff --git a/tests/Core/Filters/GitModifiedTest.php b/tests/Core/Filters/GitModifiedTest.php
index 626fb6531..ca068e144 100644
--- a/tests/Core/Filters/GitModifiedTest.php
+++ b/tests/Core/Filters/GitModifiedTest.php
@@ -211,6 +211,9 @@ final class GitModifiedTest extends AbstractFilterTestCase
      */
     public function testExecAlwaysReturnsArray($cmd, $expected)
     {
+        if (!is_dir(__DIR__ . '/../../../.git')) {
+            $this->markTestSkipped('Not a git repository');
+        }
         $fakeDI = new RecursiveArrayIterator(self::getFakeFileList());
         $filter = new GitModified($fakeDI, '/', self::$config, self::$ruleset);
 
diff --git a/tests/Core/Filters/GitStagedTest.php b/tests/Core/Filters/GitStagedTest.php
index 0009aefa7..cf5f69765 100644
--- a/tests/Core/Filters/GitStagedTest.php
+++ b/tests/Core/Filters/GitStagedTest.php
@@ -211,6 +211,9 @@ final class GitStagedTest extends AbstractFilterTestCase
      */
     public function testExecAlwaysReturnsArray($cmd, $expected)
     {
+        if (!is_dir(__DIR__ . '/../../../.git')) {
+            $this->markTestSkipped('Not a git repository');
+        }
         $fakeDI = new RecursiveArrayIterator(self::getFakeFileList());
         $filter = new GitStaged($fakeDI, '/', self::$config, self::$ruleset);
 
-- 
2.43.0