-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathRuntimePathTest.php
More file actions
38 lines (27 loc) · 1.01 KB
/
Copy pathRuntimePathTest.php
File metadata and controls
38 lines (27 loc) · 1.01 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
<?php
declare(strict_types=1);
namespace Micilini\PhpSockets\Tests\Unit\Support;
use Micilini\PhpSockets\Support\RuntimePath;
use PHPUnit\Framework\TestCase;
final class RuntimePathTest extends TestCase
{
protected function tearDown(): void
{
putenv('PHPSOCKETS_ATTACHMENT_DIR');
parent::tearDown();
}
public function testAttachmentsDirectoryUsesEnvironmentOverride(): void
{
$path = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'custom-phpsockets-attachments';
putenv('PHPSOCKETS_ATTACHMENT_DIR=' . $path);
self::assertSame($path, RuntimePath::attachmentsDirectory());
}
public function testAttachmentsDirectoryDefaultsToProjectLocalDirectory(): void
{
putenv('PHPSOCKETS_ATTACHMENT_DIR');
$path = RuntimePath::attachmentsDirectory();
self::assertStringContainsString('.phpsockets', $path);
self::assertStringContainsString('attachments', $path);
self::assertStringStartsWith((string) getcwd(), $path);
}
}