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()
145
145
{
146
146
$ stat = $ this ->getStatTemplate ();
147
147
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
149
151
$ stat [7 ] = $ stat ['size ' ] = $ this ->stream ->getSize ();
150
152
151
153
return $ stat ;
Original file line number Diff line number Diff line change @@ -49,6 +49,15 @@ public function testReadableStreamRead()
49
49
$ this ->assertSame ('' , fread ($ stream , 3 ));
50
50
}
51
51
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
+
52
61
public function testReadableStreamWrite ()
53
62
{
54
63
$ stream = $ this ->bucket ->openDownloadStream ('length-10 ' );
@@ -84,6 +93,15 @@ public function testWritableStreamRead()
84
93
$ this ->assertSame ('' , fread ($ stream , 8192 ));
85
94
}
86
95
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
+
87
105
public function testWritableStreamWrite ()
88
106
{
89
107
$ stream = $ this ->bucket ->openUploadStream ('filename ' );
You can’t perform that action at this time.
0 commit comments