protected function setUp()
 {
     $this->markTestIncomplete('Casino index relies on DB to get player');
     SessionFactory::init(new MockArraySessionStorage());
     $char_id = TestAccountCreateAndDestroy::create_testing_account();
     SessionFactory::getSession()->set('player_id', $char_id);
 }
Exemplo n.º 2
0
 public function setUp()
 {
     parent::setUp();
     SessionFactory::init(new MockArraySessionStorage());
     $char_id = TestAccountCreateAndDestroy::create_testing_account();
     SessionFactory::getSession()->set('player_id', $char_id);
 }
Exemplo n.º 3
0
 public function setUp()
 {
     parent::setUp();
     SessionFactory::init(new MockArraySessionStorage());
     $char_id = TestAccountCreateAndDestroy::create_testing_account();
     SessionFactory::getSession()->set('player_id', $char_id);
     $this->clan = Clan::create(Player::find($char_id), 'phpunit_test_clan');
 }
Exemplo n.º 4
0
 public function setUp()
 {
     parent::setUp();
     SessionFactory::init(new MockArraySessionStorage());
     $char_id = TestAccountCreateAndDestroy::create_testing_account();
     SessionFactory::getSession()->set('player_id', $char_id);
     $request = new Request([], []);
     RequestWrapper::inject($request);
 }
Exemplo n.º 5
0
 /**
  */
 protected function setUp()
 {
     // Mock the post request.
     $request = new Request([], []);
     RequestWrapper::inject($request);
     $this->char_id = TestAccountCreateAndDestroy::create_testing_account();
     $session = SessionFactory::init(new MockArraySessionStorage());
     $session->set('player_id', $this->char_id);
     $session->set('account_id', $this->char_id);
 }
Exemplo n.º 6
0
 public function testCantAttackIfExcessiveAmountOfTurnsIsRequired()
 {
     $confirm = true;
     $char_id = TestAccountCreateAndDestroy::create_testing_account($confirm);
     $this->oldify_character_last_attack($char_id);
     $char_2_id = TestAccountCreateAndDestroy::create_alternate_testing_account($confirm);
     $this->oldify_character_last_attack($char_2_id);
     $char = new Player($char_2_id);
     $legal = new AttackLegal($char_id, $char->name(), ['required_turns' => 4000000000.0, 'ignores_stealth' => true]);
     $this->assertFalse($legal->check($update_timer = false));
 }
Exemplo n.º 7
0
 public function setUp()
 {
     $this->previous_server_ip = @$_SERVER['REMOTE_ADDR'];
     $this->test_email = TestAccountCreateAndDestroy::$test_email;
     // Something@example.com
     $this->test_password = TestAccountCreateAndDestroy::$test_password;
     $this->test_ninja_name = TestAccountCreateAndDestroy::$test_ninja_name;
     TestAccountCreateAndDestroy::purge_test_accounts($this->test_ninja_name);
     $char_id = TestAccountCreateAndDestroy::create_testing_account();
     $this->char_id = $char_id;
 }
Exemplo n.º 8
0
 /**
  * group char
  **/
 function setUp()
 {
     require_once ROOT . 'core/control/Player.class.php';
     $this->previous_server_ip = @$_SERVER['REMOTE_ADDR'];
     $_SERVER['REMOTE_ADDR'] = $this->mock_ip;
     $this->test_email = TestAccountCreateAndDestroy::$test_email;
     // Something@example.com probably
     $this->test_password = TestAccountCreateAndDestroy::$test_password;
     $this->test_ninja_name = TestAccountCreateAndDestroy::$test_ninja_name;
     TestAccountCreateAndDestroy::purge_test_accounts($this->test_ninja_name);
     $char_id = TestAccountCreateAndDestroy::create_testing_account();
     $this->char_id = $char_id;
 }
 public static function char_id($confirm = false)
 {
     return TestAccountCreateAndDestroy::create_testing_account($confirm);
 }
Exemplo n.º 10
0
 /**
  * group accountconf
  **/
 function testAttemptLoginOfUnconfirmedAccountShouldFail()
 {
     $email = '*****@*****.**';
     // Create a non-autoconfirmed user
     $char_id = TestAccountCreateAndDestroy::create_testing_account($confirm = false, $email);
     $res = @login_user($email, $this->test_password);
     $this->assertFalse($res['success']);
     $this->assertTrue(is_string($res['login_error']));
     $this->assertTrue((bool) $res['login_error'], 'No error returned: ' . $res['login_error']);
 }
Exemplo n.º 11
0
 function testAttemptLoginOfUnconfirmedAccountShouldFail()
 {
     $email = '*****@*****.**';
     // Create a non-autoconfirmed user
     TestAccountCreateAndDestroy::create_testing_account(false, $email);
     RequestWrapper::inject(new Request([]));
     $controller = new LoginController();
     $res = $controller->performLogin($email, $this->test_password);
     $this->assertNotEmpty($res, 'No error returned');
 }