Ejemplo n.º 1
0
 public function testResore()
 {
     // create export
     $dao = new BackupMySQLDAO();
     $export_file = $dao->export();
     $this->pdo->query("drop table tu_plugins");
     $this->simulateLogin('*****@*****.**', true);
     $controller = new BackupController(true);
     $_FILES['backup_file']['name'] = "name";
     $_FILES['backup_file']['type'] = "application/zip";
     $_FILES['backup_file']["error"] = 0;
     $_FILES["backup_file"]["tmp_name"] = $export_file;
     $results = $controller->go();
     $this->assertPattern("/Data Import Successfull/is", $results);
     $stmt = $this->pdo->query("show create table tu_plugins");
     $data = $stmt->fetch();
     $stmt->closeCursor();
     $this->assertEqual($data['Table'], 'tu_plugins');
     $stmt = $this->pdo->query("select * from tu_plugins");
     $data = $stmt->fetch();
     $this->assertEqual($data['id'], 1);
     $this->assertEqual($data['name'], 'Twitter');
 }
Ejemplo n.º 2
0
 public function testMySQLExportFails()
 {
     // backup DAO mapping
     $dao_mapping_backup = DAOFactory::$dao_mapping['BackupDAO'];
     $this->simulateLogin('*****@*****.**', true);
     $controller = new BackupController(true);
     $_GET['backup'] = 'true';
     // no grant perms
     DAOFactory::$dao_mapping['BackupDAO']['mysql'] = 'TestBackupDAOGrantFail';
     $results = $controller->go();
     $this->assertPattern("/It looks like the MySQL user does not have the proper permissions to/", $results);
     // no file perms
     $controller = new BackupController(true);
     DAOFactory::$dao_mapping['BackupDAO']['mysql'] = 'TestBackupDAOFileFail';
     $results = $controller->go();
     $this->assertPattern("/It looks like the MySQL user does not have the proper file permissions/", $results);
     // restore DAO mapping
     DAOFactory::$dao_mapping['BackupDAO']['mysql'] = $dao_mapping_backup;
 }
Ejemplo n.º 3
0
/**
 *
 * ThinkUp/webapp/install/backup.php
 *
 * Copyright (c) 2009-2012 Mark Wilkie
 *
 * LICENSE:
 *
 * This file is part of ThinkUp (http://thinkupapp.com).
 *
 * ThinkUp is free software: you can redistribute it and/or modify it under the terms of the GNU General Public
 * License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any
 * later version.
 *
 * ThinkUp is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
 * details.
 *
 * You should have received a copy of the GNU General Public License along with ThinkUp.  If not, see
 * <http://www.gnu.org/licenses/>.
 *
 *
 * @author Mark Wilkie <mwilkie[at]gmail[dot]com>
 * @license http://www.gnu.org/licenses/gpl.html
 * @copyright 2009-2012 Mark Wilkie
 */
chdir('..');
require_once 'init.php';
$controller = new BackupController();
echo $controller->go();