Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
"scripts": {
"cs-fix": "php-cs-fixer fix",
"rector": "rector",
"test": "phpunit --testdox --no-interaction",
"test": "phpunit",
"test-watch": "phpunit-watcher watch"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -55,16 +55,14 @@ public function testRestoreErrorHandler(): void
assertSame($errorHandler, $currentErrorHandler);
}

/**
* @requires OS Linux
*/
public function testDirectoryPermission(): void
{
$directory = self::RUNTIME_DIRECTORY . '/test/create/nested/directory-permissions';

$storage = new ItemsStorage($directory . '/items.php');
$storage->add(new Permission('createPost'));

$this->assertSame(0755, TestHelper::getDirectoryPermissions($directory));
$this->assertTrue(is_writable($directory));
$this->assertTrue(is_readable($directory));
}
}
7 changes: 0 additions & 7 deletions tests/Support/TestHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

namespace Yiisoft\Rbac\Php\Tests\Support;

use function sprintf;

final class TestHelper
{
private function __construct() {}
Expand All @@ -16,9 +14,4 @@ public static function getCurrentErrorHandler(): ?callable
restore_error_handler();
return $currentHandler;
}

public static function getDirectoryPermissions(string $path): int
{
return octdec(substr(sprintf('%o', fileperms($path)), -4));
}
}