Fix unit tests + enable signup confirmation by default
- minor cleanup
This commit is contained in:
@ -72,6 +72,11 @@ class Populator {
|
||||
'name' => $user_name,
|
||||
'address' => $current_user->user_email
|
||||
));
|
||||
|
||||
// enable signup confirmation by default
|
||||
Setting::setValue('signup_confirmation', array(
|
||||
'enabled' => true
|
||||
));
|
||||
}
|
||||
|
||||
private function createDefaultSegments() {
|
||||
|
@ -31,11 +31,7 @@ class Comment {
|
||||
|
||||
if(
|
||||
isset($_POST['mailpoet']['subscribe_on_comment'])
|
||||
&&
|
||||
filter_var(
|
||||
$_POST['mailpoet']['subscribe_on_comment'],
|
||||
FILTER_VALIDATE_BOOLEAN
|
||||
) === true
|
||||
&& $_POST['mailpoet']['subscribe_on_comment']
|
||||
) {
|
||||
if($comment_status === Comment::PENDING_APPROVAL) {
|
||||
// add a comment meta to remember to subscribe the user
|
||||
|
@ -47,18 +47,24 @@ class Registration {
|
||||
isset($_POST['mailpoet']['subscribe_on_register'])
|
||||
&& $_POST['mailpoet']['subscribe_on_register']
|
||||
) {
|
||||
static::subscribeNewUser($user_login, $user_email);
|
||||
static::subscribeNewUser(
|
||||
$user_login,
|
||||
$user_email
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
private static function subscribeNewUser($login, $email) {
|
||||
$segment_ids = Setting::getValue('subscribe.on_comment.segments', array());
|
||||
private static function subscribeNewUser($name, $email) {
|
||||
$segment_ids = Setting::getValue(
|
||||
'subscribe.on_comment.segments',
|
||||
array()
|
||||
);
|
||||
|
||||
if(!empty($segment_ids)) {
|
||||
Subscriber::subscribe(
|
||||
array(
|
||||
'email' => $email,
|
||||
'first_name' => $login
|
||||
'first_name' => $name
|
||||
),
|
||||
$segment_ids
|
||||
);
|
||||
|
@ -336,7 +336,7 @@ class SubscriberCest {
|
||||
expect($subscriber->email)->equals($this->data['email']);
|
||||
expect($subscriber->first_name)->equals($this->data['first_name']);
|
||||
expect($subscriber->last_name)->equals($this->data['last_name']);
|
||||
expect($subscriber->status)->equals('unconfirmed');
|
||||
expect($subscriber->status)->equals('subscribed');
|
||||
expect($subscriber->deleted_at)->equals(null);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user