/** * Test for createHash() * * @return void * @test */ public function createHashReturnsString() { $form = new Form(); $form->_setProperty('uid', 123); $mail = new Mail(); $mail->_setProperty('uid', 123); $mail->_setProperty('pid', 124); $mail->setForm($form); $result = OptinUtility::createOptinHash($mail); $this->assertEquals('abf068777a', $result); $this->assertTrue(strlen($result) === 10); }
/** * Test for createHash() * * @return void * @test */ public function createHashReturnsString() { $GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'] = 'abcdef'; $form = new Form(); $form->_setProperty('uid', 123); $mail = new Mail(); $mail->_setProperty('uid', 123); $mail->_setProperty('pid', 124); $mail->setForm($form); $result = OptinUtility::createOptinHash($mail); $this->assertEquals('cf06c6db71', $result); $this->assertTrue(strlen($result) === 10); }
/** * Check if mail should be send * send when * - optin is deaktivated OR * - optin is active AND hash is correct * * @param Mail $mail * @param string $hash * @return bool */ protected function isSendMailActive(Mail $mail, $hash) { return empty($this->settings['main']['optin']) || !empty($this->settings['main']['optin']) && OptinUtility::checkOptinHash($hash, $mail); }