Fix tests

This commit is contained in:
Amine Ben hammou
2019-09-03 16:51:17 +01:00
committed by Jack Kitterhing
parent 3ea9c99090
commit b4bb6dd747
2 changed files with 3 additions and 1 deletions

View File

@ -106,7 +106,8 @@ class Subscriber extends Model {
function getLinkToken() {
if ($this->link_token === null) {
$this->link_token = self::generateToken($this->email);
$this->save();
// `$this->save()` fails if the subscriber has subscriptions, segments or custom fields
\ORM::rawExecute(sprintf('UPDATE %s SET link_token = ? WHERE email = ?', self::$_table), [$this->link_token, $this->email]);
}
return $this->link_token;
}

View File

@ -88,6 +88,7 @@ class ViewInBrowserTest extends \MailPoetTest {
'queue' => $this->queue,
'subscriber' => $subscriber,
'newsletter' => $this->newsletter,
'subscriber_token' => 'somewrongtoken',
]
);
expect($this->view_in_browser->_validateBrowserPreviewData($data))->false();