+ public function test_command_fails_on_zip_with_no_expected_contents()
+ {
+ $zipFile = $this->buildZip(function (\ZipArchive $zip) {
+ $zip->addFromString('spaghetti', "Hello world!");
+ });
+
+ chdir('/var/www/bookstack');
+
+ $result = $this->runCommand('restore', [
+ 'backup-zip' => $zipFile,
+ ]);
+
+ $result->assertErrorExit();
+ $result->assertStderrContains("Provided ZIP backup [{$zipFile}] does not have any expected restorable content.");
+ }
+
+ public function test_limited_restore_using_app_directory_option()
+ {
+ $zipFile = $this->buildZip(function (\ZipArchive $zip) {
+ $zip->addFromString('db.sql', "CREATE TABLE zz_testing (names varchar(255));");
+ $zip->addFromString('themes/hello.txt', "limited restore test!");
+ });
+
+ chdir('/home');
+
+ $result = $this->runCommand('restore', [
+ 'backup-zip' => $zipFile,
+ '--app-directory' => '/var/www/bookstack'
+ ], ['yes']);
+
+ $result->assertSuccessfulExit();
+ $result->assertStdoutContains('❌ .env Config File');
+ $result->assertStdoutContains('✔ Themes Folder');
+ $result->assertStdoutContains('❌ Public File Uploads');
+ $result->assertStdoutContains('❌ Private File Uploads');
+ $result->assertStdoutContains('✔ Database Dump');
+ $this->assertStringEqualsFile('/var/www/bookstack/themes/hello.txt', 'limited restore test!');
+
+ unlink('/var/www/bookstack/themes/hello.txt');
+ $mysql = new mysqli('db', 'bookstack', 'bookstack', 'bookstack');
+ $mysql->query("DROP TABLE zz_testing;");
+ }
+