@@ -105,16 +105,12 @@ MAP;
|
||||
|
||||
public function testReadMapFileThrowsWhenNotReadable(): void
|
||||
{
|
||||
$path = $this->tmpRoot . '/secret.map';
|
||||
file_put_contents($path, 'x');
|
||||
chmod($path, 0000);
|
||||
// Use a path that does not exist: is_readable() is false without chmod tricks.
|
||||
// chmod(0000) is unreliable under root / some CI images (file stays readable).
|
||||
$path = $this->tmpRoot . '/does_not_exist.map';
|
||||
$m = $this->makeManager(['magesail/nginx/global_map_path' => $path]);
|
||||
try {
|
||||
$this->expectException(LocalizedException::class);
|
||||
$m->readMapFile();
|
||||
} finally {
|
||||
chmod($path, 0644);
|
||||
}
|
||||
$this->expectException(LocalizedException::class);
|
||||
$m->readMapFile();
|
||||
}
|
||||
|
||||
public function testReadMapFileReturnsContent(): void
|
||||
@@ -157,17 +153,11 @@ MAP;
|
||||
|
||||
public function testValidateNginxConfigWhenMapUnreadable(): void
|
||||
{
|
||||
$path = $this->tmpRoot . '/nr.map';
|
||||
file_put_contents($path, 'x');
|
||||
chmod($path, 0000);
|
||||
$path = $this->tmpRoot . '/missing_for_validate.map';
|
||||
$m = $this->makeManager(['magesail/nginx/global_map_path' => $path]);
|
||||
try {
|
||||
$r = $m->validateNginxConfig();
|
||||
self::assertFalse($r['valid']);
|
||||
self::assertStringContainsString('not readable', (string) ($r['error'] ?? ''));
|
||||
} finally {
|
||||
chmod($path, 0644);
|
||||
}
|
||||
$r = $m->validateNginxConfig();
|
||||
self::assertFalse($r['valid']);
|
||||
self::assertStringContainsString('not readable', (string) ($r['error'] ?? ''));
|
||||
}
|
||||
|
||||
public function testAddAndRemoveTunnelMapping(): void
|
||||
|
||||
Reference in New Issue
Block a user