Reject requests without mandatory custom fields
We need to make sure subscribers cannot be created without custom fields Users require GDPR consent and we need to make sure there are no way to create a subscriber without mandatory custom fields [MAILPOET-1405]
This commit is contained in:
@@ -301,6 +301,21 @@ class APITest extends \MailPoetTest {
|
||||
expect($result['source'])->equals('api');
|
||||
}
|
||||
|
||||
function testItChecksForMandatoryCustomFields() {
|
||||
CustomField::createOrUpdate([
|
||||
'name' => 'custom field',
|
||||
'type' => 'text',
|
||||
'params' => ['required' => '1']
|
||||
]);
|
||||
|
||||
$subscriber = array(
|
||||
'email' => 'test@example.com',
|
||||
);
|
||||
|
||||
$this->setExpectedException('Exception');
|
||||
API::MP(self::VERSION)->addSubscriber($subscriber);
|
||||
}
|
||||
|
||||
function testItSubscribesToSegmentsWhenAddingSubscriber() {
|
||||
$API = Stub::makeEmptyExcept(
|
||||
new \MailPoet\API\MP\v1\API(),
|
||||
|
Reference in New Issue
Block a user