/** * group char **/ function tearDown() { // Delete test user. TestAccountCreateAndDestroy::purge_test_accounts($this->test_ninja_name); $_SERVER['REMOTE_ADDR'] = $this->previous_server_ip; // Reset remote addr to whatever it was before, just in case. }
function tearDown() { // Don't use naked queries outside of a model layer elsewhere. query("delete from password_reset_requests where nonce = '777777' or nonce = '77778877' or nonce = '7777777' or nonce = :nonce or _account_id = :id", [':nonce' => isset($this->nonce) ? $this->nonce : null, ':id' => $this->account_id]); TestAccountCreateAndDestroy::purge_test_accounts(); query("delete from password_reset_requests where nonce = '777777' or nonce = '77778877' or nonce = '7777777' or nonce = :nonce or _account_id = :id", [':nonce' => isset($this->nonce) ? $this->nonce : null, ':id' => $this->account_id]); }
public static function create_testing_account($confirm = false) { @session_start(); $ip = isset($_SERVER['REMOTE_ADDR']) && $_SERVER['REMOTE_ADDR'] ? $_SERVER['REMOTE_ADDR'] : '127.0.0.1'; //$previous_server = @$_SERVER['REMOTE_ADDR']; //$_SERVER['REMOTE_ADDR']=isset($_SERVER['REMOTE_ADDR']) && $_SERVER['REMOTE_ADDR']? $_SERVER['REMOTE_ADDR'] : '127.0.0.1'; TestAccountCreateAndDestroy::purge_test_accounts(); $found = get_char_id(TestAccountCreateAndDestroy::$test_ninja_name); if ((bool) $found) { throw new Exception('Test user found [' . $found . '] with name [' . TestAccountCreateAndDestroy::$test_ninja_name . '] already exists'); } // Create test user, unconfirmed, whatever the default is for activity. $preconfirm = true; $confirm = rand(1000, 9999); //generate confirmation code // Use the function from lib_player $player_params = array('send_email' => TestAccountCreateAndDestroy::$test_email, 'send_pass' => TestAccountCreateAndDestroy::$test_password, 'send_class' => 'dragon', 'preconfirm' => true, 'confirm' => $confirm, 'referred_by' => 'ninjawars.net', 'ip' => $ip); ob_start(); // Skip extra output $error = create_account_and_ninja(TestAccountCreateAndDestroy::$test_ninja_name, $player_params); ob_end_clean(); if ($confirm) { $confirmed = confirm_player(TestAccountCreateAndDestroy::$test_ninja_name, false, true); // name, no confirm #, just autoconfirm. } //$_SERVER['REMOTE_ADDR']=$previous_server; // Reset remote addr to whatever it was before. $char_id = get_char_id(TestAccountCreateAndDestroy::$test_ninja_name); return $char_id; }
public function tearDown() { RequestWrapper::inject(new Request([])); TestAccountCreateAndDestroy::purge_test_accounts(); $session = SessionFactory::getSession(); $session->invalidate(); }
public function tearDown() { RequestWrapper::destroy(); TestAccountCreateAndDestroy::purge_test_accounts(); $session = SessionFactory::getSession(); $session->invalidate(); parent::tearDown(); }
/** * Create a testing account */ public static function create_testing_account($confirm = false) { $ip = isset($_SERVER['REMOTE_ADDR']) && $_SERVER['REMOTE_ADDR'] ? $_SERVER['REMOTE_ADDR'] : '127.0.0.1'; TestAccountCreateAndDestroy::purge_test_accounts(); $found = get_char_id(TestAccountCreateAndDestroy::$test_ninja_name); if ((bool) $found) { throw new Exception('Test user found [' . $found . '] with name [' . TestAccountCreateAndDestroy::$test_ninja_name . '] already exists'); } // Create test user, unconfirmed, whatever the default is for activity. $confirm = rand(1000, 9999); //generate confirmation code $player_params = ['send_email' => TestAccountCreateAndDestroy::$test_email, 'send_pass' => TestAccountCreateAndDestroy::$test_password, 'send_class' => 'tiger', 'preconfirm' => true, 'confirm' => $confirm, 'referred_by' => 'ninjawars.net', 'ip' => $ip]; ob_start(); // Skip extra output create_account_and_ninja(TestAccountCreateAndDestroy::$test_ninja_name, $player_params); ob_end_clean(); if ($confirm) { $confirmed = confirm_player(TestAccountCreateAndDestroy::$test_ninja_name, false, true); // name, no confirm #, just autoconfirm. } return $char_id = get_char_id(TestAccountCreateAndDestroy::$test_ninja_name); }
public function tearDown() { TestAccountCreateAndDestroy::purge_test_accounts(); }
public function tearDown() { // Delete test users created in body of test functions TestAccountCreateAndDestroy::purge_test_accounts(); }
/** * group char **/ function tearDown() { // Delete test user. TestAccountCreateAndDestroy::purge_test_accounts(); }
function tearDown() { query('delete from clan where clan_id = :id', [':id' => $this->clan->id]); query('delete from clan_player where _clan_id = :id', [':id' => $this->clan->id]); TestAccountCreateAndDestroy::purge_test_accounts(); }
/** * Create a testing account */ public static function create_testing_account($confirm = false) { TestAccountCreateAndDestroy::purge_test_accounts(); return self::createAccount(TestAccountCreateAndDestroy::$test_ninja_name, TestAccountCreateAndDestroy::$test_email, 'tiger'); }
function tearDown() { query("delete from password_reset_requests where nonce = '777777' or nonce = :nonce", [':nonce' => $this->nonce]); TestAccountCreateAndDestroy::purge_test_accounts(); }
function tearDown() { $this->deleteClan($this->clan_id); $this->deleteClanByIdentity('someTestClan'); TestAccountCreateAndDestroy::purge_test_accounts(); }
/** * group accountconf **/ function testThatTestAccountLibActuallyWorksToCreateAndDestroyATestNinja() { TestAccountCreateAndDestroy::purge_test_accounts(); $test_char_id = TestAccountCreateAndDestroy::create_testing_account(); $this->assertTrue((bool) positive_int($test_char_id)); }
/** * Destroy the mock login. */ public function loginTearDown() { $session = SessionFactory::getSession(); $session->invalidate(); TestAccountCreateAndDestroy::purge_test_accounts(); }