Completed
Push — master ( 2908f7...acb26a )
by
unknown
31:18
created
tests/lib/BinaryFinderTest.php 1 patch
Indentation   +64 added lines, -64 removed lines patch added patch discarded remove patch
@@ -17,76 +17,76 @@
 block discarded – undo
17 17
 use OCP\Server;
18 18
 
19 19
 class BinaryFinderTest extends TestCase {
20
-	private ICache $cache;
21
-	private ICacheFactory $cacheFactory;
22
-	private $oldEnv;
20
+    private ICache $cache;
21
+    private ICacheFactory $cacheFactory;
22
+    private $oldEnv;
23 23
 
24
-	protected function setUp(): void {
25
-		$this->oldEnv = getenv('PATH');
26
-		// BinaryFinder always includes the "PATH" environment variable into the search path,
27
-		// which we want to avoid in this test because they are not usually found in webserver
28
-		// deployments.
29
-		putenv('PATH=""');
30
-		$this->cacheFactory = $this->createMock(ICacheFactory::class);
31
-		$this->cache = new ArrayCache();
32
-		$this->cacheFactory->method('createLocal')->with('findBinaryPath')->willReturn($this->cache);
33
-	}
24
+    protected function setUp(): void {
25
+        $this->oldEnv = getenv('PATH');
26
+        // BinaryFinder always includes the "PATH" environment variable into the search path,
27
+        // which we want to avoid in this test because they are not usually found in webserver
28
+        // deployments.
29
+        putenv('PATH=""');
30
+        $this->cacheFactory = $this->createMock(ICacheFactory::class);
31
+        $this->cache = new ArrayCache();
32
+        $this->cacheFactory->method('createLocal')->with('findBinaryPath')->willReturn($this->cache);
33
+    }
34 34
 
35
-	protected function tearDown(): void {
36
-		putenv('PATH=' . $this->oldEnv);
37
-	}
35
+    protected function tearDown(): void {
36
+        putenv('PATH=' . $this->oldEnv);
37
+    }
38 38
 
39
-	public function testDefaultFindsCat() {
40
-		$config = $this->createMock(IConfig::class);
41
-		$config
42
-			->method('getSystemValue')
43
-			->with('binary_search_paths', $this->anything())
44
-			->willReturnCallback(function ($key, $default) {
45
-				return $default;
46
-			});
47
-		$finder = new BinaryFinder($this->cacheFactory, $config);
48
-		$this->assertStringEndsWith('/cat', $finder->findBinaryPath('cat'));
49
-		$this->assertStringEndsWith('/cat', $this->cache->get('cat'));
50
-	}
39
+    public function testDefaultFindsCat() {
40
+        $config = $this->createMock(IConfig::class);
41
+        $config
42
+            ->method('getSystemValue')
43
+            ->with('binary_search_paths', $this->anything())
44
+            ->willReturnCallback(function ($key, $default) {
45
+                return $default;
46
+            });
47
+        $finder = new BinaryFinder($this->cacheFactory, $config);
48
+        $this->assertStringEndsWith('/cat', $finder->findBinaryPath('cat'));
49
+        $this->assertStringEndsWith('/cat', $this->cache->get('cat'));
50
+    }
51 51
 
52
-	public function testDefaultDoesNotFindCata() {
53
-		$config = $this->createMock(IConfig::class);
54
-		$config
55
-			->method('getSystemValue')
56
-			->with('binary_search_paths', $this->anything())
57
-			->willReturnCallback(function ($key, $default) {
58
-				return $default;
59
-			});
60
-		$finder = new BinaryFinder($this->cacheFactory, $config);
61
-		$this->assertFalse($finder->findBinaryPath('cata'));
62
-		$this->assertFalse($this->cache->get('cata'));
63
-	}
52
+    public function testDefaultDoesNotFindCata() {
53
+        $config = $this->createMock(IConfig::class);
54
+        $config
55
+            ->method('getSystemValue')
56
+            ->with('binary_search_paths', $this->anything())
57
+            ->willReturnCallback(function ($key, $default) {
58
+                return $default;
59
+            });
60
+        $finder = new BinaryFinder($this->cacheFactory, $config);
61
+        $this->assertFalse($finder->findBinaryPath('cata'));
62
+        $this->assertFalse($this->cache->get('cata'));
63
+    }
64 64
 
65
-	public function testCustomPathFindsCat() {
66
-		$tmpdir = Server::get(ITempManager::class)->getTemporaryFolder();
67
-		touch($tmpdir . '/cat');
68
-		chmod($tmpdir . '/cat', 100);
65
+    public function testCustomPathFindsCat() {
66
+        $tmpdir = Server::get(ITempManager::class)->getTemporaryFolder();
67
+        touch($tmpdir . '/cat');
68
+        chmod($tmpdir . '/cat', 100);
69 69
 
70
-		$config = $this->createMock(IConfig::class);
71
-		$config
72
-			->method('getSystemValue')
73
-			->with('binary_search_paths', $this->anything())
74
-			->willReturn([$tmpdir]);
75
-		$finder = new BinaryFinder($this->cacheFactory, $config);
76
-		$this->assertEquals($tmpdir . '/cat', $finder->findBinaryPath('cat'));
77
-		$this->assertEquals($tmpdir . '/cat', $this->cache->get('cat'));
78
-	}
70
+        $config = $this->createMock(IConfig::class);
71
+        $config
72
+            ->method('getSystemValue')
73
+            ->with('binary_search_paths', $this->anything())
74
+            ->willReturn([$tmpdir]);
75
+        $finder = new BinaryFinder($this->cacheFactory, $config);
76
+        $this->assertEquals($tmpdir . '/cat', $finder->findBinaryPath('cat'));
77
+        $this->assertEquals($tmpdir . '/cat', $this->cache->get('cat'));
78
+    }
79 79
 
80
-	public function testWrongCustomPathDoesNotFindCat() {
81
-		$tmpdir = Server::get(ITempManager::class)->getTemporaryFolder();
80
+    public function testWrongCustomPathDoesNotFindCat() {
81
+        $tmpdir = Server::get(ITempManager::class)->getTemporaryFolder();
82 82
 
83
-		$config = $this->createMock(IConfig::class);
84
-		$config
85
-			->method('getSystemValue')
86
-			->with('binary_search_paths')
87
-			->willReturn([$tmpdir]);
88
-		$finder = new BinaryFinder($this->cacheFactory, $config);
89
-		$this->assertFalse($finder->findBinaryPath('cat'));
90
-		$this->assertFalse($this->cache->get('cat'));
91
-	}
83
+        $config = $this->createMock(IConfig::class);
84
+        $config
85
+            ->method('getSystemValue')
86
+            ->with('binary_search_paths')
87
+            ->willReturn([$tmpdir]);
88
+        $finder = new BinaryFinder($this->cacheFactory, $config);
89
+        $this->assertFalse($finder->findBinaryPath('cat'));
90
+        $this->assertFalse($this->cache->get('cat'));
91
+    }
92 92
 }
Please login to merge, or discard this patch.