Files
piratepoet/mailpoet/tests/integration/Form/FormSaveControllerTest.php
Rodrigo Primo afe378ba22 Replace expect()->equals() with verify()->equals()
codeception/verify 2.1 removed support for expect()->equals() so we need
to replace it with verify()->equals().

[MAILPOET-5664]
2023-10-24 08:58:22 +03:00

34 lines
1015 B
PHP

<?php declare(strict_types = 1);
namespace MailPoet\Form;
use Codeception\Util\Fixtures;
use MailPoet\Entities\FormEntity;
class FormSaveControllerTest extends \MailPoetTest {
/** @var FormSaveController */
private $saveController;
public function _before() {
parent::_before();
$this->saveController = $this->diContainer->get(FormSaveController::class);
}
public function testItDuplicatesForms() {
$form = $this->createForm();
$duplicate = $this->saveController->duplicate($form);
verify($duplicate->getName())->equals('Copy of ' . $form->getName());
verify($duplicate->getDeletedAt())->equals(null);
verify($duplicate->getBody())->equals($form->getBody());
verify($duplicate->getStatus())->equals($form->getStatus());
}
private function createForm(): FormEntity {
$form = new FormEntity('My Form');
$form->setBody(Fixtures::get('form_body_template'));
$this->entityManager->persist($form);
$this->entityManager->flush();
return $form;
}
}