Skip to content

Commit 60bae9e

Browse files
committed
test: improve FileHandler tests portability on root and Windows
1 parent 82d406c commit 60bae9e

2 files changed

Lines changed: 10 additions & 0 deletions

File tree

tests/_support/Session/FileHandlerCloseFail.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ final class FileHandlerCloseFail extends FileHandler
2525
{
2626
public function close(): bool
2727
{
28+
parent::close();
29+
2830
return false;
2931
}
3032
}

tests/system/Session/Handlers/FileHandlerTest.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,10 @@ public function testOpenThrowsForWriteProtectedSavePath(): void
241241
mkdir($dir, 0700);
242242
chmod($dir, 0555);
243243

244+
if (is_writable($dir)) {
245+
$this->markTestSkipped('Directory permissions cannot be restricted for this user (e.g. running as root).');
246+
}
247+
244248
try {
245249
$handler = $this->getInstance();
246250

@@ -533,6 +537,10 @@ public function testGCWhenDirectoryCannotBeOpened(): void
533537
mkdir($dir, 0700);
534538
chmod($dir, 0000);
535539

540+
if (@opendir($dir) !== false) {
541+
$this->markTestSkipped('Directory permissions cannot be restricted for this user (e.g. running as root).');
542+
}
543+
536544
try {
537545
$handler = $this->getInstance(['savePath' => $dir]);
538546

0 commit comments

Comments
 (0)