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(); }
public function setUp() { parent::setUp(); $table = new USVN_Db_Table_Projects(); $project = $table->fetchNew(); $project->setFromArray(array('projects_name' => 'project1', 'projects_start_date' => '1984-12-03 00:00:00')); $this->_projectid1 = $project->save(); $table = new USVN_Db_Table_Projects(); $project = $table->fetchNew(); $project->setFromArray(array('projects_name' => 'project2', 'projects_start_date' => '1984-12-03 00:00:00')); $this->_projectid2 = $project->save(); $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(); }
public function testUpdateOnlyDesc() { $table = new USVN_Db_Table_Groups(); $obj = $table->fetchNew(); $obj->setFromArray(array('groups_name' => 'UpdateGroupOk')); $id = $obj->save(); $this->assertTrue($table->isAGroup('UpdateGroupOk')); $obj = $table->find($id)->current(); $obj->setFromArray(array('groups_description' => 'test')); $id = $obj->save(); $this->assertTrue($table->isAGroup('UpdateGroupOk')); }
/** * Genere un tableau de groupe * * @param int $n */ function _generateGroups($n) { $table = new USVN_Db_Table_Groups(); $ret = array(); for ($i = 1; $i <= $n; $i++) { $ret[$i - 1] = $table->fetchNew(); $ret[$i - 1]->name = "group{$i}"; $ret[$i - 1]->save(); } return $ret; }