File tree Expand file tree Collapse file tree 2 files changed +16
-5
lines changed
Expand file tree Collapse file tree 2 files changed +16
-5
lines changed Original file line number Diff line number Diff line change @@ -65,7 +65,11 @@ public function isFile()
6565 */
6666 public function isImage ()
6767 {
68- return starts_with ($ this ->mimeType (), 'image ' );
68+ if (!$ this ->isDirectory ()) {
69+ return starts_with ($ this ->mimeType (), 'image ' );
70+ }
71+
72+ return false ;
6973 }
7074
7175 /**
@@ -105,7 +109,11 @@ public function size()
105109
106110 public function time ()
107111 {
108- return $ this ->lfm ->lastModified ();
112+ if (!$ this ->isDirectory ()) {
113+ return $ this ->lfm ->lastModified ();
114+ }
115+
116+ return false ;
109117 }
110118
111119 public function thumbUrl ()
Original file line number Diff line number Diff line change @@ -75,7 +75,8 @@ public function testIsFile()
7575
7676 public function testIsImage ()
7777 {
78- $ this ->lfm_path ->shouldReceive ('mimeType ' )->andReturn ('application/plain ' );
78+ $ this ->lfm_path ->shouldReceive ('mimeType ' )->andReturn ('application/plain ' )->shouldReceive ('isDirectory ' )
79+ ->andReturn (false );
7980
8081 $ item = new LfmItem ($ this ->lfm_path , $ this ->lfm );
8182
@@ -150,7 +151,8 @@ public function testSize()
150151
151152 public function testTime ()
152153 {
153- $ this ->lfm_path ->shouldReceive ('lastModified ' )->andReturn (0 );
154+ $ this ->lfm_path ->shouldReceive ('lastModified ' )->andReturn (0 )->shouldReceive ('isDirectory ' )
155+ ->andReturn (false );
154156
155157 $ item = new LfmItem ($ this ->lfm_path , $ this ->lfm );
156158
@@ -185,7 +187,8 @@ public function testIcon()
185187
186188 public function testHasThumb ()
187189 {
188- $ this ->lfm_path ->shouldReceive ('mimeType ' )->andReturn ('application/plain ' );
190+ $ this ->lfm_path ->shouldReceive ('mimeType ' )->andReturn ('application/plain ' )->shouldReceive ('isDirectory ' )
191+ ->andReturn (false );
189192
190193 $ item = new LfmItem ($ this ->lfm_path , $ this ->lfm );
191194
You can’t perform that action at this time.
0 commit comments