-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExtensionPathProblemTest.php
More file actions
54 lines (43 loc) · 1.78 KB
/
ExtensionPathProblemTest.php
File metadata and controls
54 lines (43 loc) · 1.78 KB
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
42
43
44
45
46
47
48
49
50
51
52
53
54
<?php
declare(strict_types=1);
namespace Php\PieUnitTest\Platform\TargetPhp\Exception;
use Php\Pie\Platform\TargetPhp\Exception\ExtensionPathProblem;
use Php\Pie\Platform\TargetPhp\PhpBinaryPath;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\TestCase;
#[CoversClass(ExtensionPathProblem::class)]
final class ExtensionPathProblemTest extends TestCase
{
public function testExtensionPathNotSet(): void
{
$php = PhpBinaryPath::fromCurrentProcess();
self::assertSame(
'Could not determine extension path for ' . $php->phpBinaryPath . '; extension_dir => not set',
ExtensionPathProblem::new($php, null)->getMessage(),
);
}
public function testExtensionPathDoesNotExist(): void
{
$php = PhpBinaryPath::fromCurrentProcess();
self::assertSame(
'Could not determine extension path for ' . $php->phpBinaryPath . '; extension_dir => /path/does/not/exist; does not exist',
ExtensionPathProblem::new($php, '/path/does/not/exist')->getMessage(),
);
}
public function testExtensionPathIsAFile(): void
{
$php = PhpBinaryPath::fromCurrentProcess();
self::assertSame(
'Could not determine extension path for ' . $php->phpBinaryPath . '; extension_dir => ' . __FILE__ . '; exists, not a directory',
ExtensionPathProblem::new($php, __FILE__)->getMessage(),
);
}
public function testExtensionPathIsADir(): void
{
$php = PhpBinaryPath::fromCurrentProcess();
self::assertSame(
'Could not determine extension path for ' . $php->phpBinaryPath . '; extension_dir => ' . __DIR__ . '; exists, is a directory',
ExtensionPathProblem::new($php, __DIR__)->getMessage(),
);
}
}