public function test_indexEmptyProject() { $project = USVN_Project::createProject(array('projects_name' => 'empty', 'projects_start_date' => '1984-12-03 00:00:00'), "john", true, true, true, false); $this->request->setParam('project', 'empty'); $this->runAction('index'); $this->assertContains("http://localhost/test/svn/empty", $this->getBody()); $this->assertNotContains("http://localhost/test/svn/empty/trunk", $this->getBody()); }
public function createAction() { $data = $this->getProjectData($_POST); if (empty($data)) { $this->_redirect("/admin/project/new"); } try { $identity = Zend_Auth::getInstance()->getIdentity(); USVN_Project::createProject($data, $identity['username'], $_POST['creategroup'], $_POST['addmetogroup'], $_POST['admin'], $_POST['createsvndir']); $this->_redirect("/admin/project/"); } catch (USVN_Exception $e) { $this->view->message = nl2br($e->getMessage()); $this->newAction(); $this->view->project->setFromArray($data); $this->render('new'); } }
public function setUp() { parent::setUp(); $table = new USVN_Db_Table_Users(); $this->_user = $table->fetchNew(); $this->_user->setFromArray(array('users_login' => 'test', 'users_password' => 'password', 'users_firstname' => 'firstname', 'users_lastname' => 'lastname', 'users_email' => '*****@*****.**')); $this->_user->save(); $this->_projectid1 = USVN_Project::createProject(array('projects_name' => "project1"), "test", true, false, false, true)->id; $this->_projectid2 = USVN_Project::createProject(array('projects_name' => "project2"), "test", true, false, false, true)->id; $group_table = new USVN_Db_Table_Groups(); $group = $group_table->fetchNew(); $group->setFromArray(array("groups_name" => "toto")); $this->_groupid1 = $group->save(); $group_table = new USVN_Db_Table_Groups(); $group = $group_table->fetchNew(); $group->setFromArray(array("groups_name" => "titi")); $this->_groupid2 = $group->save(); }
/** * Import all SVN Repositories added * * @throws USVN_Exception * @return array USVN_Db_Table_Row_Project */ public function importSVNRepositories() { if (count($this->_repos)) { foreach ($this->_repos as $k => $repo) { $project = USVN_Project::createProject(array('projects_name' => $repo['name'], 'projects_description' => $repo['options']['description']), $repo['options']['login'], $repo['options']['creategroup'], $repo['options']['addmetogroup'], $repo['options']['admin'], 0); //0, we don't want to create branch's, trunk's and tag's directory //no need to check if the project have been created, an exception will be throw in this case $this->_repos_imported[] = $project; unset($this->_repos[$k]); } } return $this->_repos_imported; }
public function testDeleteProject() { USVN_Project::createProject(array('projects_name' => 'InsertProjectOK', 'projects_start_date' => '1984-12-03 00:00:00'), "test", true, true, true, false); USVN_Project::deleteProject('InsertProjectOK'); $table = new USVN_Db_Table_Projects(); $this->assertFalse($table->isAProject('InsertProjectOk'), "Le projet n'est pas supprime"); $table_groups = new USVN_Db_Table_Groups(); $this->assertFalse($table_groups->isAGroup('InsertProjectOk'), "Le groupe n'est pas supprime"); }
/** * Genere un tableau de projet * * @param int $n */ function _generateProjects($n) { $table = new USVN_Db_Table_Projects(); $ret = array(); for ($i = 1; $i <= $n; $i++) { $ret[$i - 1] = USVN_Project::createProject(array('projects_name' => "project{$i}"), "test", true, false, false, false); } return $ret; }