File tree 2 files changed +13
-3
lines changed
2 files changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -242,7 +242,7 @@ function unlink(string $path): Promise {
242
242
* @param bool $recursive
243
243
* @return \Amp\Promise<null>
244
244
*/
245
- function mkdir (string $ path , int $ mode = 0644 , bool $ recursive = false ): Promise {
245
+ function mkdir (string $ path , int $ mode = 0777 , bool $ recursive = false ): Promise {
246
246
return filesystem ()->mkdir ($ path , $ mode , $ recursive );
247
247
}
248
248
Original file line number Diff line number Diff line change @@ -224,9 +224,11 @@ public function testMkdirRmdir() {
224
224
225
225
$ dir = "{$ fixtureDir }/newdir " ;
226
226
227
+ \umask (0022 );
228
+
227
229
yield File \mkdir ($ dir );
228
230
$ stat = yield File \stat ($ dir );
229
- $ this ->assertSame (0644 , $ stat[ " mode " ] & 0777 );
231
+ $ this ->assertSame (' 0755 ' , $ this -> getPermissionsFromStat ( $ stat) );
230
232
yield File \rmdir ($ dir );
231
233
$ this ->assertNull (yield File \stat ($ dir ));
232
234
@@ -235,7 +237,7 @@ public function testMkdirRmdir() {
235
237
236
238
yield File \mkdir ($ dir , 0764 , true );
237
239
$ stat = yield File \stat ($ dir );
238
- $ this ->assertSame (0764 & (~ \umask ()) , $ stat[ " mode " ] & 0777 );
240
+ $ this ->assertSame (' 0744 ' , $ this -> getPermissionsFromStat ( $ stat) );
239
241
});
240
242
}
241
243
@@ -325,4 +327,12 @@ public function testTouch() {
325
327
$ this ->assertTrue ($ newStat ["mtime " ] > $ oldStat ["mtime " ]);
326
328
});
327
329
}
330
+
331
+ /**
332
+ * @param array $stat
333
+ * @return string
334
+ */
335
+ private function getPermissionsFromStat (array $ stat ): string {
336
+ return \substr (\decoct ($ stat ["mode " ]), 1 );
337
+ }
328
338
}
You can’t perform that action at this time.
0 commit comments