/** * */ public function testIsSomething() { $data = $this->testData; unset($data['zip']); $ddObj = new DonationData($this->getFreshGatewayObject(self::$initial_vars), $data); //change to test mode with explicit test data $this->assertEquals($ddObj->isSomething('zip'), false, "Zip should currently be nothing."); $this->assertEquals($ddObj->isSomething('lname'), true, "Lname should currently be something."); }
/** * token_checkTokens * The main function to check the salted and MD5'd token we should have * saved and gathered from the request, against the clear-text token we * should have saved to the user's session. * token_getSaltedSessionToken() will start off the process if this is a * first load, and there's no saved token in the session yet. * @staticvar string $match * @return bool */ protected function token_checkTokens() { static $match = null; //because we only want to do this once per load. if ($match === null) { // establish the edit token to prevent csrf $token = $this->token_getSaltedSessionToken(); $this->logger->debug('editToken: ' . $token); // match token if (!$this->dataObj->isSomething('wmf_token')) { $this->addRequestData(array('wmf_token' => $token)); } $token_check = $this->getData_Unstaged_Escaped('wmf_token'); $match = $this->token_matchEditToken($token_check); if ($this->dataObj->wasPosted()) { $this->logger->debug('Submitted edit token: ' . $token_check); $this->logger->debug('Token match: ' . ($match ? 'true' : 'false')); } } return $match; }
/** * */ public function testIsSomething() { $data = $this->testData; unset($data['zip']); $ddObj = new DonationData('', true, $data); $this->assertEquals($ddObj->isSomething('zip'), false, "Zip should currently be nothing."); $this->assertEquals($ddObj->isSomething('lname'), true, "Lname should currently be something."); }