$stat = stat($path);
$mode = $stat['mode'] & 0777;
expect($mode)->toBe(0755);
});
it("creates a nested directory with a specific mode", function () {
$path = $this->tmpDir . '/My/Nested/Directory';
$actual = Dir::make($path, ['mode' => 0777]);
expect($actual)->toBe(true);
expect(file_exists($path))->toBe(true);
$stat = stat($path);
$mode = $stat['mode'] & 0777;
expect($mode)->toBe(0777);
});
it("creates multiple nested directories in a single call", function () {
$paths = [$this->tmpDir . '/My/Nested/Directory', $this->tmpDir . '/Sub/Nested/Directory'];
$actual = Dir::make($paths);
expect($actual)->toBe(true);
foreach ($paths as $path) {
expect(file_exists($path))->toBe(true);
}
});
});
describe("::tempnam()", function () {
it("uses the system temp directory by default", function () {
$dir = Dir::tempnam(null, 'spec');
$temp = sys_get_temp_dir();
expect($this->normalize($dir))->toMatch('~' . $this->normalize($temp) . '/spe~');
Dir::remove($dir);
});
});
});