コード例 #1
0
 public function testFreshInstallStep3SuccessfulInstall()
 {
     self::time(__METHOD__);
     //get valid credentials
     $config = Config::getInstance();
     $valid_db_username = $config->getValue('db_user');
     $valid_db_pwd = $config->getValue('db_password');
     $valid_db_name = $config->getValue('db_name');
     $valid_db_host = $config->getValue('db_host');
     $valid_db_socket = $config->getValue('db_socket');
     //drop DB
     $this->testdb_helper->drop($this->test_database_name);
     //remove config file
     $config = null;
     Config::destroyInstance();
     //unset PDO so it must be recreated
     InstallerMySQLDAO::$PDO = null;
     //remove config file
     $this->removeConfigFile();
     //force a refresh of getTables
     Installer::$show_tables = null;
     //set param for step 3
     $_GET['step'] = '3';
     //set post values from form
     $_POST['site_email'] = "*****@*****.**";
     $_POST['password'] = "******";
     $_POST['confirm_password'] = "******";
     $_POST['db_user'] = $valid_db_username;
     $_POST['db_passwd'] = $valid_db_pwd;
     $_POST['db_name'] = $valid_db_name;
     //$_POST['db_name'] = 'thinkup_install';
     $_POST['db_type'] = "mysql";
     $_POST['db_host'] = $valid_db_host;
     $_POST['db_socket'] = $valid_db_socket;
     $_POST['db_port'] = "";
     $_POST['db_prefix'] = "tu_";
     $_POST['full_name'] = "My Full Name";
     $_POST['timezone'] = "America/Los_Angeles";
     $_SERVER['HTTP_HOST'] = "example.com";
     $controller = new InstallerController(true);
     $this->assertTrue(isset($controller));
     $result = $controller->go();
     $this->debug($result);
     $this->assertPattern('/ThinkUp has been successfully installed./', $result);
     $option_dao = DAOFactory::getDAO('OptionDAO');
     $current_stored_server_name = $option_dao->getOptionByName(OptionDAO::APP_OPTIONS, 'server_name');
     $this->assertNotNull($current_stored_server_name);
     $this->assertEqual($current_stored_server_name->option_value, 'example.com');
     $this->assertEqual($current_stored_server_name->option_name, 'server_name');
     $install_email = Mailer::getLastMail();
     $this->debug($install_email);
     $this->assertPattern("/http:\\/\\/example.com\\/session\\/activate.php\\?usr=you\\%40example.com\\&code\\=/", $install_email);
     $this->restoreConfigFile();
     //echo $result;
 }
コード例 #2
0
 public function testFreshInstallStep3SuccessfulInstall()
 {
     //get valid credentials
     $config = Config::getInstance();
     $valid_db_username = $config->getValue('db_user');
     $valid_db_pwd = $config->getValue('db_password');
     $valid_db_name = $config->getValue('db_name');
     $valid_db_host = $config->getValue('db_host');
     $valid_db_socket = $config->getValue('db_socket');
     //drop DB
     $this->testdb_helper->drop($this->test_database_name);
     //remove config file
     $config = null;
     Config::destroyInstance();
     //unset PDO so it must be recreated
     InstallerMySQLDAO::$PDO = null;
     //remove config file
     $this->removeConfigFile();
     //force a refresh of getTables
     Installer::$show_tables = null;
     //set param for step 3
     $_GET['step'] = '3';
     //set post values from form
     $_POST['site_email'] = "*****@*****.**";
     $_POST['password'] = "******";
     $_POST['confirm_password'] = "******";
     $_POST['db_user'] = $valid_db_username;
     $_POST['db_passwd'] = $valid_db_pwd;
     $_POST['db_name'] = $valid_db_name;
     //$_POST['db_name'] = 'thinkup_install';
     $_POST['db_type'] = "mysql";
     $_POST['db_host'] = $valid_db_host;
     $_POST['db_socket'] = $valid_db_socket;
     $_POST['db_port'] = "";
     $_POST['db_prefix'] = "tu_";
     $_POST['full_name'] = "My Full Name";
     $_POST['timezone'] = "America/Los_Angeles";
     $_SERVER['HTTP_HOST'] = "http://example.com";
     $controller = new InstallerController(true);
     $this->assertTrue(isset($controller));
     $result = $controller->go();
     $this->assertPattern('/ThinkUp has been installed successfully./', $result);
     $this->restoreConfigFile();
     //echo $result;
 }