public function test_database_backup_connection_failure() { $paths['backup'] = WP_CONTENT_DIR . '/backups'; $database = new Signalfire_Cloud_Backup_Database($paths['backup'], 1, 2, 3); $paths['db'] = $database->create_database_backup(); $this->assertFalse($paths['db']); }
/** * Executes database backup using local mysqldump command. * * @since 1.0.0 * @param array $paths The paths array * @param string $username The database username * @param string $password The database password * @param string $name The database name * @access public * @return boolean Returns if task executed successfully */ public function execute_database_backup($paths, $config) { //Get instance of database object $database = new Signalfire_Cloud_Backup_Database($paths['backup'], $config['user'], $config['pass'], $config['name']); //Execute backup and return the path of the database sql file created, or false if ($paths['db'] = $database->create_database_backup()) { //Create a SplFileInfo object from the database file path $file = $this->create_spl_file('db', $paths); //Get instance of zip object $zip = new Signalfire_Cloud_Backup_Zip($file, $paths['backup'], 'database'); //Create a zip archive and return its path if created, otherwise false if ($paths['zip'] = $zip->create_zip_archive()) { //Delete the SQL file created unlink($paths['db']); //Return that function completed successfully return TRUE; } } //Failed so return false return FALSE; }