Remove old Form model from the subscribers test

[MAILPOET-3644]
This commit is contained in:
Pavel Dohnal
2021-09-15 13:39:06 +02:00
committed by Veljko V
parent 942d756b9f
commit 0f618cdc64

View File

@@ -23,7 +23,6 @@ use MailPoet\Entities\SubscriberSegmentEntity;
use MailPoet\Form\Util\FieldNameObfuscator; use MailPoet\Form\Util\FieldNameObfuscator;
use MailPoet\Listing\Handler; use MailPoet\Listing\Handler;
use MailPoet\Models\CustomField; use MailPoet\Models\CustomField;
use MailPoet\Models\Form;
use MailPoet\Models\Newsletter; use MailPoet\Models\Newsletter;
use MailPoet\Models\NewsletterOption; use MailPoet\Models\NewsletterOption;
use MailPoet\Models\NewsletterOptionField; use MailPoet\Models\NewsletterOptionField;
@@ -680,9 +679,8 @@ class SubscribersTest extends \MailPoetTest {
'type' => 'text', 'type' => 'text',
'params' => ['required' => '1'], 'params' => ['required' => '1'],
]); ]);
$form = Form::createOrUpdate([ $form = new FormEntity('form');
'name' => 'form', $form->setBody([[
'body' => [[
'type' => 'text', 'type' => 'text',
'name' => 'mandatory', 'name' => 'mandatory',
'id' => $customField->id(), 'id' => $customField->id(),
@@ -690,11 +688,12 @@ class SubscribersTest extends \MailPoetTest {
'static' => '0', 'static' => '0',
'params' => ['required' => '1'], 'params' => ['required' => '1'],
'position' => '0', 'position' => '0',
]], ]]);
]); $this->entityManager->persist($form);
$this->entityManager->flush();
$response = $this->endpoint->subscribe([ $response = $this->endpoint->subscribe([
$this->obfuscatedEmail => 'toto@mailpoet.com', $this->obfuscatedEmail => 'toto@mailpoet.com',
'form_id' => $form->id, 'form_id' => $form->getId(),
$this->obfuscatedSegments => [$this->segment1->getId(), $this->segment2->getId()], $this->obfuscatedSegments => [$this->segment1->getId(), $this->segment2->getId()],
]); ]);
expect($response->status)->equals(APIResponse::STATUS_BAD_REQUEST); expect($response->status)->equals(APIResponse::STATUS_BAD_REQUEST);