コード例 #1
0
 public function shouldBeAbleToGetAccessToRoles()
 {
     // given
     $pl = new Player();
     $pl->setFullName("Alf Magne Kalleland");
     $pl->commit();
     // then
     $this->assertFalse($pl->hasAccessTo(ChessRoles::LOGIN));
 }
コード例 #2
0
 private function createAdminUser($details)
 {
     if (isset($details['adminUserName']) && isset($details['adminUserName'])) {
         $pl = new Player();
         $pl->grantAdminAccess();
         $pl->setUsername($details['adminUserName']);
         $pl->setPassword($details['adminPassword']);
         $pl->commit();
         $session = new Session();
         $session->signIn(array('username' => $details['adminUserName'], 'password' => $details['adminPassword'], 'rememberMe' => true));
     }
 }
コード例 #3
0
 public function createUser($username, $password)
 {
     $player = new Player();
     if (!$player->exists()) {
         $player->createTable();
     }
     $player->setUsername($username);
     $player->setPassword($password);
     $player->setEmail('*****@*****.**');
     $player->setOnlinePlayer('1');
     $player->commit();
     return $player;
 }
コード例 #4
0
ファイル: EloTest.php プロジェクト: manishkhanchandani/mkgxy
 private function getUserWithNonProvisionalElo($eloValue = null)
 {
     $pl = new Player();
     $pl->setUsername(uniqid('user'));
     $pl->setPassword(uniqid('pass'));
     $pl->commit();
     $eloSetter = new EloSetter(1);
     for ($i = 0; $i < 10; $i++) {
         $eloSetter->registerResult($pl, $this->getUserWithElo(1500), 1);
         $eloSetter->registerResult($pl, $this->getUserWithElo(1400), 1);
         $eloSetter->registerResult($pl, $this->getUserWithElo(1200), -1);
         $eloSetter->registerResult($pl, $this->getUserWithElo(2000), 0.5);
     }
     if (isset($eloValue)) {
         $elo = new Elo($pl->getId(), 1);
         $elo->setElo($eloValue);
         $elo->commit();
         return new Player($pl->getId());
     }
     return $pl;
 }
コード例 #5
0
 private function createPlayer()
 {
     $p = new Player();
     $p->setEmail('*****@*****.**');
     $p->commit();
 }
コード例 #6
0
ファイル: Game.php プロジェクト: manishkhanchandani/mkgxy
 private function getPlayerIdByName($name)
 {
     $player = new PlayerByName($name);
     if (!$player->getId()) {
         $p = new Player();
         $p->setFullName($name);
         $p->setOnlinePlayer(0);
         $p->commit();
         return $p->getId();
     }
     return $player->getId();
 }