public function setUp() { parent::setUp(); $this->account_id = TestAccountCreateAndDestroy::account_id(); $this->account = Account::findById($this->account_id); $this->nonce = Crypto::nonce(); }
public function setUp() { $_SERVER['REMOTE_ADDR'] = isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : '127.0.0.1'; $this->test_email = TestAccountCreateAndDestroy::$test_email; $this->test_password = TestAccountCreateAndDestroy::$test_password; $this->test_ninja_name = TestAccountCreateAndDestroy::$test_ninja_name; TestAccountCreateAndDestroy::purge_test_accounts(TestAccountCreateAndDestroy::$test_ninja_name); $this->testAccountId = TestAccountCreateAndDestroy::account_id(); }
function setUp() { $this->account_id = TestAccountCreateAndDestroy::account_id(); $this->account = AccountFactory::findById($this->account_id); $this->nonce = nonce(); }
public function testPerformingAResetInvalidatesUsedRequest() { $account_id = TestAccountCreateAndDestroy::account_id(); $account = AccountFactory::findById($account_id); PasswordResetRequest::generate($account, $this->nonce = '77warkwark', false); PasswordResetRequest::reset($account, 'new_pass34532'); $req = PasswordResetRequest::match($this->nonce); $this->assertEmpty($req); // Request shouldn't match because it should already be used. }
public function testLoginShouldFailOnBlanks() { $account = Account::findById(TestAccountCreateAndDestroy::account_id()); $this->assertInstanceOf(Account::class, $account); $account->confirmed = 0; $account->save(); $request = new Request([], ['user' => '', 'pass' => '']); // TestAccountCreateAndDestroy::$test_password RequestWrapper::inject($request); $controller = new LoginController(); $res = $controller->requestLogin($this->m_dependencies); $this->assertInstanceOf(RedirectResponse::class, $res); $this->assertTrue(stripos($res->getTargetUrl(), 'error') !== false); }