/** * @test */ public function isRequested() { $user1 = $this->getUser("test1"); $user2 = $this->getUser("test2"); $user3 = $this->getUser("test3"); $this->isTrue(Request::isRequested($user1->id, $user2->id)); $this->isTrue(Request::isRequested($user3->id, $user2->id)); $this->isFalse(Request::isRequested($user2->id, $user1->id)); $this->isFalse(Request::isRequested($user2->id, $user3->id)); }
/** * @test */ public function deny() { $follow = $this->getLogic("follow"); $user1 = $this->getUser("test1"); $user2 = $this->getUser("test2"); $follow->add($user1->id, $user2->id); $this->isTrue(Request::isRequested($user1->id, $user2->id)); $this->isFalse(Follower::isFollowed($user1->id, $user2->id)); $follow->deny($user2->id, $user1->id); $this->isFalse(Request::isRequested($user1->id, $user2->id)); $this->isFalse(Follower::isFollowed($user1->id, $user2->id)); $this->clear("Follower"); $this->clear("Request"); }
protected function home() { $protected = $this->aUser->isProtected(); $this->clientId = $this->session->getClientId(); if ($authenticated = $this->aclUser->isAuthenticated()) { $this->isFollowed = Follower::isFollowed($this->aclUser->id, $this->aUser->uid); if ($this->isFollowed) { $protected = false; } } if ($protected) { if ($authenticated) { $this->isRequested = Request::isRequested($this->aclUser->id, $this->aUser->uid); } $this->view->setName("protected"); } else { $helper = new Helpers_Paginator_Status(); $this->paginator = $helper->getStatuses($this->aUser->uid, $this->GET_VARS, 50); $this->view->setName("home"); } }
/** * @test */ public function moveRequestsToFollower() { $user2 = $this->getUser("test2"); $this->isTrue($user2->isProtected()); $user1 = $this->getUser("test1"); $user3 = $this->getUser("test3"); $request = new Request(); $request->insert(array("user_id" => $user1->id, "request_id" => $user2->id, "created_at" => now())); $request->insert(array("user_id" => $user3->id, "request_id" => $user2->id, "created_at" => now())); $this->isTrue(Request::isRequested($user1->id, $user2->id)); $this->isTrue(Request::isRequested($user3->id, $user2->id)); $this->isFalse(Follower::isFollowed($user1->id, $user2->id)); $this->isFalse(Follower::isFollowed($user3->id, $user2->id)); $user2->private_flag = false; $this->getLogic("user")->updateSettings($user2); $this->isFalse($user2->isProtected()); $this->isFalse(Request::isRequested($user1->id, $user2->id)); $this->isFalse(Request::isRequested($user3->id, $user2->id)); $this->isTrue(Follower::isFollowed($user1->id, $user2->id)); $this->isTrue(Follower::isFollowed($user3->id, $user2->id)); $this->clear("Request"); $this->clear("Follower"); }