public function upFixture() { $user = new User(); $user1 = $user->selectOne("user_name", "test1"); $user2 = $user->selectOne("user_name", "test2"); $user3 = $user->selectOne("user_name", "test3"); $this->insert(array("user_id" => $user1->id, "request_id" => $user2->id, "created_at" => "2008-01-01 00:00:00")); $this->insert(array("user_id" => $user3->id, "request_id" => $user2->id, "created_at" => "2008-02-01 00:00:00")); }
/** * @param string $actKey アクティベーション・キー * * @return Logics_Result */ public function register($actKey) { $result = new Logics_Result(); $user = new User(); $aUser = $user->selectOne("act_key", $actKey); if ($aUser->isSelected()) { $aUser->save(array("act_key" => null)); $result->aUser = $aUser; } else { throw new Exception_UserNotFound(__METHOD__); } return $result; }
public function upFixture() { $user = new User(); $user1 = $user->selectOne("user_name", "test1"); $user2 = $user->selectOne("user_name", "test2"); $user3 = $user->selectOne("user_name", "test3"); for ($i = 1; $i < 10; $i++) { $this->insert(array("user_id" => $user1->id, "comment" => "comment{$i}", "created_at" => "2008-01-0{$i} 00:00:00")); } for ($i = 1; $i < 10; $i++) { $this->insert(array("user_id" => $user1->id, "reply_user_id" => $user3->id, "comment" => "@test3 comment{$i}", "created_at" => "2008-01-0{$i} 06:00:00")); } for ($i = 1; $i < 10; $i++) { $this->insert(array("user_id" => $user3->id, "comment" => "comment{$i}", "created_at" => "2008-01-0{$i} 12:00:00")); } for ($i = 1; $i < 10; $i++) { $this->insert(array("user_id" => $user3->id, "reply_user_id" => $user1->id, "comment" => "@test1 comment{$i}", "created_at" => "2008-01-0{$i} 18:00:00")); } for ($i = 1; $i < 10; $i++) { $this->insert(array("user_id" => $user2->id, "comment" => "comment{$i}", "created_at" => "2008-01-0{$i} 23:59:59")); } }
public function upFixture() { $user = new User(); for ($i = 1; $i <= 10; $i++) { ${"user{$i}"} = $user->selectOne("user_name", "test{$i}"); } $this->insert(array("user_id" => $user1->id, "follow_id" => $user3->id, "created_at" => "2008-01-01 00:00:00")); $this->insert(array("user_id" => $user3->id, "follow_id" => $user1->id, "created_at" => "2008-02-01 00:00:00")); $this->insert(array("user_id" => $user2->id, "follow_id" => $user1->id, "created_at" => "2008-03-01 00:00:00")); $this->insert(array("user_id" => $user2->id, "follow_id" => $user3->id, "created_at" => "2008-04-01 00:00:00")); for ($i = 4; $i <= 9; $i++) { $this->insert(array("user_id" => $user10->id, "follow_id" => ${"user{$i}"}->id, "created_at" => "2008-10-0{$i} 00:00:00")); $this->insert(array("user_id" => ${"user{$i}"}->id, "follow_id" => $user10->id, "created_at" => "2008-0{$i}-10 00:00:00")); } }
/** * @test */ public function post() { $comment = <<<COMMENT test test test test COMMENT; $user = new User(); $aUser = $user->selectOne("user_name", "test1"); $aStatus = Status::post($aUser->id, $comment); $this->eq("test test test test", $aStatus->comment); $user = new User(); $user2 = $user->selectOne("user_name", "test2"); $comment = "@test2 test"; $aStatus = Status::post($aUser->id, $comment); $this->eq($user2->id, $aStatus->reply_user_id); $this->clear("Status"); }
protected function getUser($name) { $user = new User(); return $user->selectOne("user_name", $name); }