protected function setUp() { parent::setUp(); $groups = new USVN_Db_Table_Groups(); $groups->insert(array("groups_id" => 42, "groups_name" => "Telephone", "groups_description" => "test")); $groups->insert(array("groups_id" => 43, "groups_name" => "Indochine", "groups_description" => "Bob morane")); }
protected function setUp() { parent::setUp(); $projects = new USVN_Db_Table_Projects(); $projects->insert(array("projects_id" => 42, "projects_name" => "Telephone", 'projects_start_date' => '1984-12-03 00:00:00', "projects_description" => "test")); $projects->insert(array("projects_id" => 43, "projects_name" => "Indochine", 'projects_start_date' => '1984-12-03 00:00:00', "projects_description" => "Bob morane")); $groups = new USVN_Db_Table_Groups(); $groups->insert(array("groups_id" => 42, "groups_name" => "Telephone", "groups_description" => "test")); $groups->insert(array("groups_id" => 43, "groups_name" => "Indochine", "groups_description" => "Bob morane")); }
public function test_indexActionTwoGroup() { $groups = new USVN_Db_Table_Groups(); $g1 = $groups->insert(array("groups_id" => 42, "groups_name" => "Telephone", "groups_description" => "test")); $g2 = $groups->insert(array("groups_id" => 43, "groups_name" => "Indochine", "groups_description" => "Bob morane")); $this->user->addGroup($g1); $this->user->addGroup($g2); $this->runAction('index'); $this->assertEquals(2, count($this->controller->view->groups)); $this->assertContains('href="/group/Indochine">Indochine</a>', $this->getBody(), $this->getBody()); $this->assertContains('href="/group/Telephone">Telephone</a>', $this->getBody()); }
protected function setUp() { parent::setUp(); $users = new USVN_Db_Table_Users(); $users->insert(array("users_id" => 42, "users_login" => "Telephone", "users_password" => "secret")); $users->insert(array("users_id" => 43, "users_login" => "Indochine", "users_password" => "secret")); $groups = new USVN_Db_Table_Groups(); $groups->insert(array("groups_id" => 42, "groups_name" => "Telephone", "groups_description" => "test")); }
public function testfetchAllAssignedTwoUserInGroup() { $table_user = new USVN_Db_Table_Users(); $user = $table_user->fetchNew(); $user->setFromArray(array('users_login' => 'test', 'users_password' => 'password', 'users_firstname' => 'firstname', 'users_lastname' => 'lastname', 'users_email' => '*****@*****.**')); $user->save(); $user2 = $table_user->fetchNew(); $user2->setFromArray(array('users_login' => 'test2', 'users_password' => 'password', 'users_firstname' => 'firstname', 'users_lastname' => 'lastname', 'users_email' => '*****@*****.**')); $user2->save(); $table_project = new USVN_Db_Table_Projects(); $project = $table_project->fetchNew(); $project->setFromArray(array('projects_name' => 'InsertProjectOk', 'projects_start_date' => '1984-12-03 00:00:00')); $project->save(); $project2 = $table_project->fetchNew(); $project2->setFromArray(array('projects_name' => 'Project2', 'projects_start_date' => '1984-12-03 00:00:00')); $project2->save(); $group_table = new USVN_Db_Table_Groups(); $group_table->insert(array("groups_id" => 2, "groups_name" => "toto")); $group = $group_table->find(2)->current(); $group_table = new USVN_Db_Table_Groups(); $group_table->insert(array("groups_id" => 3, "groups_name" => "titi")); $group = $group_table->find(3)->current(); $project->addGroup($group); $this->assertEquals(count($table_project->fetchAllAssignedTo($user)), 0); $group->addUser($user); $group->addUser($user2); $this->assertEquals(count($table_project->fetchAllAssignedTo($user)), 1); }