Remove old Form model from the widget test

[MAILPOET-3644]
This commit is contained in:
Pavel Dohnal
2021-09-15 13:42:31 +02:00
committed by Veljko V
parent 0f618cdc64
commit 05d69913a6

View File

@@ -2,34 +2,33 @@
namespace MailPoet\Test\Form; namespace MailPoet\Test\Form;
use MailPoet\Entities\FormEntity;
use MailPoet\Form\Widget; use MailPoet\Form\Widget;
use MailPoet\Models\Form;
use MailPoet\Util\pQuery\pQuery; use MailPoet\Util\pQuery\pQuery;
use MailPoet\WP\Functions as WPFunctions; use MailPoet\WP\Functions as WPFunctions;
class WidgetTest extends \MailPoetTest { class WidgetTest extends \MailPoetTest {
public function testItAllowsModifyingRenderedFormWidgetViaHook() { public function testItAllowsModifyingRenderedFormWidgetViaHook() {
$form = Form::createOrUpdate( $form = new FormEntity('Test Form');
[ $form->setBody([
'name' => 'Test Form',
'body' => [
[ [
'type' => 'text', 'type' => 'text',
'id' => 'email', 'id' => 'email',
], ],
], ]);
'settings' => [ $form->setSettings([
'success_message' => 'Hello!', 'success_message' => 'Hello!',
], ]);
] $this->entityManager->persist($form);
); $this->entityManager->flush();
$formWidget = new Widget(); $formWidget = new Widget();
// form target is set to _self by default // form target is set to _self by default
$renderedFormWidget = $formWidget->widget( $renderedFormWidget = $formWidget->widget(
[], [],
[ [
'form' => $form->id, 'form' => $form->getId(),
'form_type' => 'html', 'form_type' => 'html',
] ]
); );
@@ -47,7 +46,7 @@ class WidgetTest extends \MailPoetTest {
$renderedFormWidget = $formWidget->widget( $renderedFormWidget = $formWidget->widget(
[], [],
[ [
'form' => $form->id, 'form' => $form->getId(),
'form_type' => 'html', 'form_type' => 'html',
] ]
); );