コード例 #1
0
 /**
  * First access time should not change for Window Length contests
  */
 public function testAccessTimeIsAlwaysFirstAccessForWindowLength()
 {
     // Get a contest
     $contestData = ContestsFactory::createContest();
     // Convert contest into WindowLength one
     ContestsFactory::makeContestWindowLength($contestData, 20);
     // Get a user for our scenario
     $contestant = UserFactory::createUser();
     // Prepare our request
     $r = new Request();
     $r['contest_alias'] = $contestData['request']['alias'];
     // Log in the user
     $r['auth_token'] = $this->login($contestant);
     // Explicitly join contest
     ContestController::apiOpen($r);
     // Call api
     $response = ContestController::apiDetails($r);
     // We need to grab the access time from the ContestUsers table
     $contest = ContestsDAO::getByAlias($contestData['request']['alias']);
     $contest_user = ContestsUsersDAO::getByPK($contestant->getUserId(), $contest->getContestId());
     $firstAccessTime = $contest_user->getAccessTime();
     // Call API again, access time should not change
     $response = ContestController::apiDetails($r);
     $contest_user = ContestsUsersDAO::getByPK($contestant->getUserId(), $contest->getContestId());
     $this->assertEquals($firstAccessTime, $contest_user->getAccessTime());
 }