File tree Expand file tree Collapse file tree 2 files changed +21
-0
lines changed
Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -151,6 +151,14 @@ public function flush()
151151 }
152152 }
153153
154+ foreach ($ this ->files ->files ($ this ->directory ) as $ file ) {
155+ if (preg_match ('/facade-.*\.php$/ ' , $ file )) {
156+ if (! $ this ->files ->delete ($ file )) {
157+ return false ;
158+ }
159+ }
160+ }
161+
154162 return true ;
155163 }
156164
Original file line number Diff line number Diff line change @@ -167,6 +167,19 @@ public function testFlushIgnoreNonExistingDirectory()
167167 $ this ->assertFalse ($ result , 'Flush should not clean directory ' );
168168 }
169169
170+ public function testFlushCleansRealTimeFacades ()
171+ {
172+ $ files = $ this ->mockFilesystem ();
173+ $ files ->expects ($ this ->once ())->method ('isDirectory ' )->with ($ this ->equalTo (__DIR__ ))->will ($ this ->returnValue (true ));
174+ $ files ->expects ($ this ->once ())->method ('directories ' )->with ($ this ->equalTo (__DIR__ ))->will ($ this ->returnValue ([]));
175+ $ files ->expects ($ this ->once ())->method ('files ' )->with ($ this ->equalTo (__DIR__ ))->will ($ this ->returnValue (['/facade-XXX.php ' ]));
176+ $ files ->expects ($ this ->once ())->method ('delete ' )->with ($ this ->equalTo ('/facade-XXX.php ' ))->will ($ this ->returnValue (true ));
177+
178+ $ store = new FileStore ($ files , __DIR__ );
179+ $ result = $ store ->flush ();
180+ $ this ->assertTrue ($ result , 'Flush failed ' );
181+ }
182+
170183 protected function mockFilesystem ()
171184 {
172185 return $ this ->createMock ('Illuminate\Filesystem\Filesystem ' );
You can’t perform that action at this time.
0 commit comments