mirror of
https://github.com/NNTmux/newznab-tmux.git
synced 2026-08-28 17:01:16 +00:00
Fix failing tests
This commit is contained in:
@@ -368,6 +368,14 @@ class NzbService
|
|||||||
{
|
{
|
||||||
$nzbPath = $this->siteNzbPath;
|
$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++) {
|
for ($i = 0; $i < $levelsToSplit && $i < 32; $i++) {
|
||||||
$nzbPath .= $releaseGuid[$i].'/';
|
$nzbPath .= $releaseGuid[$i].'/';
|
||||||
|
|
||||||
|
|||||||
@@ -124,7 +124,6 @@ final class NzbServicePathResolutionTest extends TestCase
|
|||||||
{
|
{
|
||||||
$tempDir = sys_get_temp_dir().'/nzb-path-permissions-'.uniqid('', true);
|
$tempDir = sys_get_temp_dir().'/nzb-path-permissions-'.uniqid('', true);
|
||||||
$basePath = $tempDir.'/';
|
$basePath = $tempDir.'/';
|
||||||
mkdir($basePath, 0775, true);
|
|
||||||
$previousUmask = umask(0022);
|
$previousUmask = umask(0022);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -140,7 +139,7 @@ final class NzbServicePathResolutionTest extends TestCase
|
|||||||
$path = $service->buildNzbPath('4aabfe07-daff-4d28-9d1d-d2a4ab7b6511', 4, true);
|
$path = $service->buildNzbPath('4aabfe07-daff-4d28-9d1d-d2a4ab7b6511', 4, true);
|
||||||
|
|
||||||
$this->assertSame($basePath.'4/a/a/b/', $path);
|
$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);
|
$this->assertSame(02775, fileperms($directory) & 07777);
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
|
|||||||
Reference in New Issue
Block a user