File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change 22
33use CodeIgniter \Config \Config ;
44use CodeIgniter \Files \Exceptions \FileNotFoundException ;
5+ use CodeIgniter \HTTP \DownloadResponse ;
56use CodeIgniter \Test \ControllerTestTrait ;
67use Tatter \Files \Controllers \Files ;
78use Tatter \Files \Entities \File ;
@@ -229,4 +230,19 @@ public function humanize()
229230 $ result = $ controller ->display ();
230231 $ this ->assertStringContainsString ($ file ->filename , $ result );
231232 }
233+
234+ //--------------------------------------------------------------------
235+
236+ public function testExportCreatesRecord ()
237+ {
238+ $ file = fake (FileFaker::class, [
239+ 'localname ' => 'image.jpg ' ,
240+ ]);
241+
242+ $ this ->controller (Files::class);
243+ $ result = $ this ->execute ('export ' , 'download ' , $ file ->id );
244+
245+ $ this ->assertInstanceOf (DownloadResponse::class, $ result ->response ());
246+ $ this ->seeInDatabase ('exports ' , ['file_id ' => $ file ->id ]);
247+ }
232248}
You can’t perform that action at this time.
0 commit comments