protected function cron($cmd)
{
- system("/usr/bin/php -q /usr/share/gforge/$cmd");
+ $this->runCommand(RUN_JOB_PATH."forge_run_job $cmd");
+ }
+
+ protected function cron_for_plugin($cmd, $plugin)
+ {
+ $this->runCommand(RUN_JOB_PATH."forge_run_plugin_job $plugin $cmd");
}
protected function init() {
} elseif (!is_array($what)) {
$what = array($what) ;
}
- $this->switchUser ('admin') ;
+ $this->switchUser (FORGE_ADMIN_USERNAME) ;
+
+ $this->createProject ('Tmpl');
+
+ $this->click("link=Site Admin");
+ $this->waitForPageToLoad("30000");
+ $this->click("link=Display Full Project List/Edit Projects");
+ $this->waitForPageToLoad("30000");
+ $this->click("link=Tmpl");
+ $this->waitForPageToLoad("30000");
+ $this->select ("//select[@name='form_template']", "label=Yes") ;
+ $this->click("submit");
+ $this->waitForPageToLoad("30000");
- $this->approveProject ('Template', 'admin');
- $this->open( ROOT . '/projects/template') ;
+ $this->open( ROOT . '/projects/tmpl') ;
$this->waitForPageToLoad("30000");
$this->click("link=Admin");
$this->waitForPageToLoad("30000");
$this->type("name", "URL");
$this->type("alias", "url");
- $this->click("document.forms[2].field_type[3]");
+ $this->click("//input[@name='field_type' and @value=4]");
$this->click("post_changes");
$this->waitForPageToLoad("30000");
$this->type("forum_name", "Developers-Discussion");
$this->type("description", "Project Developer Discussion");
- $this->click("//input[@name='is_public' and @value='0']");
$this->click("submit");
$this->waitForPageToLoad("30000");
$this->assertTrue($this->isTextPresent("Forum added successfully"));
}
}
- protected function initSvn($project='ProjectA', $user='admin')
+ protected function initSvn($project='ProjectA', $user=FORGE_ADMIN_USERNAME)
{
// Remove svnroot directory before creating the project.
$repo = '/var/lib/gforge/chroot/scmrepos/svn/'.strtolower($project);
$this->init($project, $user);
// Run manually the cron for creating the svn structure.
- $this->cron("cronjobs/create_scm_repos.php");
+ $this->cron("create_scm_repos.php");
}
protected function login($username)
protected function triggeredLogin($username)
{
- if ($username == 'admin') {
- $password = 'myadmin';
+ if ($username == FORGE_ADMIN_USERNAME) {
+ $password = FORGE_ADMIN_PASSWORD;
} else {
- $password = 'password';
+ $password = FORGE_OTHER_PASSWORD;
}
$this->type("form_loginname", $username);
$this->type("description", "This is the public description for $name.");
$this->type("unix_name", $unix_name);
$this->click("//input[@name='scm' and @value='scmsvn']");
+
+ if ($this->isElementPresent("//select[@name='built_from_template']/option[.='Tmpl']")) {
+ $this->select("//select[@name='built_from_template']", "label=Tmpl");
+ }
+
$this->click("submit");
$this->waitForPageToLoad("30000");
$this->assertTrue($this->isTextPresent("Your project has been submitted"));
protected function createProject ($name) {
$unix_name = strtolower($name);
- $this->switchUser ('admin') ;
-
+ $this->switchUser (FORGE_ADMIN_USERNAME) ;
+
// Create a simple project.
if ((!defined('PROJECTA')) || ($unix_name != "projecta")) {
- $this->registerProject ($name, 'admin') ;
- $this->approveProject ($name, 'admin') ;
+ $this->registerProject ($name, FORGE_ADMIN_USERNAME) ;
+ $this->approveProject ($name, FORGE_ADMIN_USERNAME) ;
}
}
$this->clickAndWait("link=Site Admin");
$this->clickAndWait("link=Register a New User");
$this->type("unix_name", $login);
- $this->type("password1", "password");
- $this->type("password2", "password");
+ $this->type("password1", FORGE_OTHER_PASSWORD);
+ $this->type("password2", FORGE_OTHER_PASSWORD);
$this->type("firstname", $login);
$this->type("lastname", "Lastname");
$this->type("email", $login."@debug.log");
}
protected function activatePlugin($pluginName) {
- $this->switchUser('admin');
+ $this->switchUser(FORGE_ADMIN_USERNAME);
$this->open( ROOT . '/admin/pluginman.php?update='.$pluginName.'&action=deactivate');
$this->waitForPageToLoad("30000");
$this->open( ROOT . '/admin/pluginman.php?update='.$pluginName.'&action=activate');