Fix failing tests

This commit is contained in:
DariusIII
2026-08-13 14:40:02 +02:00
parent 9af6ba1df5
commit 658937bee1
2 changed files with 9 additions and 2 deletions
+8
View File
@@ -368,6 +368,14 @@ class NzbService
{
$nzbPath = $this->siteNzbPath;
if ($createIfNotExist && ! File::isDirectory($nzbPath)) {
if (! File::makeDirectory($nzbPath, 0775, true) && ! File::isDirectory($nzbPath)) { // @phpstan-ignore booleanNot.alwaysTrue
throw new \RuntimeException(sprintf('Directory "%s" was not created', $nzbPath));
}
File::chmod($nzbPath, 02775);
}
for ($i = 0; $i < $levelsToSplit && $i < 32; $i++) {
$nzbPath .= $releaseGuid[$i].'/';
+1 -2
View File
@@ -124,7 +124,6 @@ final class NzbServicePathResolutionTest extends TestCase
{
$tempDir = sys_get_temp_dir().'/nzb-path-permissions-'.uniqid('', true);
$basePath = $tempDir.'/';
mkdir($basePath, 0775, true);
$previousUmask = umask(0022);
try {
@@ -140,7 +139,7 @@ final class NzbServicePathResolutionTest extends TestCase
$path = $service->buildNzbPath('4aabfe07-daff-4d28-9d1d-d2a4ab7b6511', 4, true);
$this->assertSame($basePath.'4/a/a/b/', $path);
foreach ([$basePath.'4', $basePath.'4/a', $basePath.'4/a/a', $basePath.'4/a/a/b'] as $directory) {
foreach ([rtrim($basePath, '/'), $basePath.'4', $basePath.'4/a', $basePath.'4/a/a', $basePath.'4/a/a/b'] as $directory) {
$this->assertSame(02775, fileperms($directory) & 07777);
}
} finally {