File tree Expand file tree Collapse file tree 2 files changed +17
-3
lines changed Expand file tree Collapse file tree 2 files changed +17
-3
lines changed Original file line number Diff line number Diff line change @@ -23,13 +23,13 @@ public function handle()
2323
2424 $ snapshotName = $ this ->argument ('name ' ) ?: Carbon::now ()->format ('Y-m-d_H-i-s ' );
2525
26- $ compress = $ this ->option ('compress ' , null );
26+ $ compress = $ this ->option ('compress ' ) || config ( ' db-snapshots.compress ' , false );
2727
2828 $ snapshot = app (SnapshotFactory::class)->create (
2929 $ snapshotName ,
3030 config ('db-snapshots.disk ' ),
3131 $ connectionName ,
32- ( $ compress !== null ) ? $ compress : ( bool ) config ( ' db-snapshots.compress ' , false )
32+ $ compress
3333 );
3434
3535 $ size = Format::humanReadableSize ($ snapshot ->size ());
Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ public function it_can_create_a_snapshot_with_specific_name()
2727 }
2828
2929 /** @test */
30- public function it_can_create_a_compressed_snapshot ()
30+ public function it_can_create_a_compressed_snapshot_from_cli_param ()
3131 {
3232 Artisan::call ('snapshot:create ' , ['--compress ' => true ]);
3333
@@ -37,4 +37,18 @@ public function it_can_create_a_compressed_snapshot()
3737
3838 $ this ->assertNotEmpty (gzdecode ($ this ->disk ->get ($ fileName )));
3939 }
40+
41+ /** @test */
42+ public function it_can_create_a_compressed_snapshot_from_config ()
43+ {
44+ $ this ->app ['config ' ]->set ('db-snapshots.compress ' , true );
45+
46+ Artisan::call ('snapshot:create ' );
47+
48+ $ fileName = Carbon::now ()->format ('Y-m-d_H-i-s ' ).'.sql.gz ' ;
49+
50+ $ this ->disk ->assertExists ($ fileName );
51+
52+ $ this ->assertNotEmpty (gzdecode ($ this ->disk ->get ($ fileName )));
53+ }
4054}
You can’t perform that action at this time.
0 commit comments