File tree Expand file tree Collapse file tree 2 files changed +21
-1
lines changed
Expand file tree Collapse file tree 2 files changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -145,7 +145,9 @@ public function stream_stat()
145145 {
146146 $ stat = $ this ->getStatTemplate ();
147147
148- $ stat [2 ] = $ stat ['mode ' ] = $ this ->mode ;
148+ $ stat [2 ] = $ stat ['mode ' ] = $ this ->stream instanceof ReadableStream
149+ ? 0100444 // S_IFREG & S_IRUSR & S_IRGRP & S_IROTH
150+ : 0100222 ; // S_IFREG & S_IWUSR & S_IWGRP & S_IWOTH
149151 $ stat [7 ] = $ stat ['size ' ] = $ this ->stream ->getSize ();
150152
151153 return $ stat ;
Original file line number Diff line number Diff line change @@ -49,6 +49,15 @@ public function testReadableStreamRead()
4949 $ this ->assertSame ('' , fread ($ stream , 3 ));
5050 }
5151
52+ public function testReadableStreamStat ()
53+ {
54+ $ stream = $ this ->bucket ->openDownloadStream ('length-10 ' );
55+
56+ $ stat = fstat ($ stream );
57+ $ this ->assertSame (0100444 , $ stat [2 ]);
58+ $ this ->assertSame (0100444 , $ stat ['mode ' ]);
59+ }
60+
5261 public function testReadableStreamWrite ()
5362 {
5463 $ stream = $ this ->bucket ->openDownloadStream ('length-10 ' );
@@ -84,6 +93,15 @@ public function testWritableStreamRead()
8493 $ this ->assertSame ('' , fread ($ stream , 8192 ));
8594 }
8695
96+ public function testWritableStreamStat ()
97+ {
98+ $ stream = $ this ->bucket ->openUploadStream ('filename ' );
99+
100+ $ stat = fstat ($ stream );
101+ $ this ->assertSame (0100222 , $ stat [2 ]);
102+ $ this ->assertSame (0100222 , $ stat ['mode ' ]);
103+ }
104+
87105 public function testWritableStreamWrite ()
88106 {
89107 $ stream = $ this ->bucket ->openUploadStream ('filename ' );
You can’t perform that action at this time.
0 commit comments