@@ -86,11 +86,20 @@ public function testExecute(): void
8686 $ expectedFilename = Configure::readOrFail ('DatabaseBackup.target ' ) . 'my_backup.sql ' ;
8787
8888 $ BackupExport = Mockery::mock ('overload: ' . BackupExport::class);
89- $ BackupExport ->shouldReceive ('__construct ' )->with ('' )->once ();
90- $ BackupExport ->shouldNotReceive ('timeout ' );
91- $ BackupExport ->shouldNotReceive ('filename ' );
92- $ BackupExport ->shouldNotReceive ('compression ' );
93- $ BackupExport ->shouldReceive ('export ' )->once ()->andReturn ($ expectedFilename );
89+ $ BackupExport
90+ ->shouldReceive ('__construct ' )
91+ ->once ()
92+ ->with ('' );
93+ $ BackupExport
94+ ->shouldNotReceive ('timeout ' );
95+ $ BackupExport
96+ ->shouldNotReceive ('filename ' );
97+ $ BackupExport
98+ ->shouldNotReceive ('compression ' );
99+ $ BackupExport
100+ ->shouldReceive ('export ' )
101+ ->once ()
102+ ->andReturn ($ expectedFilename );
94103
95104 $ this ->exec ('database_backup.export ' );
96105
@@ -108,12 +117,25 @@ public function testExecuteWithSomeOptions(): void
108117 $ filename = 'custom_filename.sql ' ;
109118
110119 $ BackupExport = Mockery::mock ('overload: ' . BackupExport::class);
111- $ BackupExport ->shouldReceive ('__construct ' )->with ('custom_connection ' )->once ();
112- $ BackupExport ->shouldReceive ('timeout ' )->with (120 )->once ();
113- $ BackupExport ->shouldReceive ('filename ' )->with ($ filename )->once ();
120+ $ BackupExport
121+ ->shouldReceive ('__construct ' )
122+ ->once ()
123+ ->with ('custom_connection ' );
124+ $ BackupExport
125+ ->shouldReceive ('timeout ' )
126+ ->once ()
127+ ->with (120 );
128+ $ BackupExport
129+ ->shouldReceive ('filename ' )
130+ ->once ()
131+ ->with ($ filename );
114132 //Note that in this case the `--compression` option was passed, but is ignored
115- $ BackupExport ->shouldNotReceive ('compression ' );
116- $ BackupExport ->shouldReceive ('export ' )->once ()->andReturn ($ filename );
133+ $ BackupExport
134+ ->shouldNotReceive ('compression ' );
135+ $ BackupExport
136+ ->shouldReceive ('export ' )
137+ ->once ()
138+ ->andReturn ($ filename );
117139
118140 $ this ->exec ('database_backup.export --connection custom_connection --timeout 120 --compression gzip --filename ' . $ filename );
119141
@@ -129,11 +151,22 @@ public function testExecuteWithSomeOptions(): void
129151 public function testExecuteWithCompressionOption (): void
130152 {
131153 $ BackupExport = Mockery::mock ('overload: ' . BackupExport::class);
132- $ BackupExport ->shouldReceive ('__construct ' )->with ('' )->once ();
133- $ BackupExport ->shouldNotReceive ('timeout ' );
134- $ BackupExport ->shouldNotReceive ('filename ' );
135- $ BackupExport ->shouldReceive ('compression ' )->with ('gzip ' )->once ();
136- $ BackupExport ->shouldReceive ('export ' )->once ()->andReturn ('my_backup.sql.gz ' );
154+ $ BackupExport
155+ ->shouldReceive ('__construct ' )
156+ ->once ()
157+ ->with ('' );
158+ $ BackupExport
159+ ->shouldNotReceive ('timeout ' );
160+ $ BackupExport
161+ ->shouldNotReceive ('filename ' );
162+ $ BackupExport
163+ ->shouldReceive ('compression ' )
164+ ->once ()
165+ ->with ('gzip ' );
166+ $ BackupExport
167+ ->shouldReceive ('export ' )
168+ ->once ()
169+ ->andReturn ('my_backup.sql.gz ' );
137170
138171 $ this ->exec ('database_backup.export --compression gzip ' );
139172
0 commit comments