PluginProbe
WP-Optimize – Cache, Compress images, Minify & Clean database to boost page speed & performance / 3.2.5
WP-Optimize – Cache, Compress images, Minify & Clean database to boost page speed & performance v3.2.5
4.7.0 4.6.1 4.6.0 4.5.5 4.5.4 4.5.3 4.5.2 3.2.20 3.2.21 3.2.22 3.2.3 3.2.5 3.2.6 3.2.7 3.2.9 3.3.0 3.3.1 3.3.2 3.4.0 3.4.1 3.4.2 3.5.0 3.6.0 3.7.0 3.7.1 All 111 releases
wp-optimize / vendor / rosell-dk / exec-with-fallback / tests / AvailabilityTest.php

AvailabilityTest.php in WP-Optimize – Cache, Compress images, Minify & Clean database to boost page speed & performance 3.2.5, at vendor/rosell-dk/exec-with-fallback/tests/AvailabilityTest.php

36 lines 1.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace ExecWithFallback\Tests;
3
4 use PHPUnit\Framework\TestCase;
5 use ExecWithFallback\Availability;
6
7 class AvailabilityTest extends TestCase
8 {
9
10 public function testMethodAvailable()
11 {
12 $methods = ['exec', 'passthru', 'popen', 'proc_open', 'shell_exec'];
13 $anyAvailable = false;
14 $anyOtherThanShellExecAvailable = false;
15 foreach ($methods as $method) {
16 if (function_exists($method)) {
17 $anyAvailable = true;
18 if ($method == 'shell_exec') {
19 $this->assertTrue(Availability::methodAvailable($method, false));
20 $this->assertFalse(Availability::methodAvailable($method, true));
21 $this->assertFalse(Availability::methodAvailable($method));
22 } else {
23 $anyOtherThanShellExecAvailable = true;
24 $this->assertTrue(Availability::methodAvailable($method));
25 }
26 } else {
27 $this->assertFalse(Availability::methodAvailable($method));
28 }
29 }
30
31 $this->assertSame($anyAvailable, Availability::anyAvailable(false));
32 $this->assertSame($anyOtherThanShellExecAvailable, Availability::anyAvailable(true));
33 $this->assertSame($anyOtherThanShellExecAvailable, Availability::anyAvailable());
34 }
35 }
36