with('backup:run', []) ->once() ->andReturn(0); Storage::disk('test-disk')->put('test-backup/test-file.zip', 'content'); $action = new SystemBackup(); $backup = $action->execute(); $this->assertInstanceOf(Backup::class, $backup); $this->assertEquals('test-backup test-file.zip', $backup->file_name); $this->assertEquals('test-disk', $backup->disk); $this->assertEquals('test-backup/test-file.zip', $backup->path); $this->assertEquals(7, $backup->getRawOriginal('size')); $this->assertDatabaseHas('backups', [ 'file_name' => 'test-backup test-file.zip', 'disk' => 'test-disk', 'path' => 'test-backup/test-file.zip', 'size' => 7, 'type' => 'full', ]); } }