Files
piratepoet/tests/integration/Form/FormsRepositoryTest.php
Rodrigo Primo e054f05222 Refactor Forms::trash() to use Doctrine
[MAILPOET-3039]
2021-04-12 13:35:14 +02:00

34 lines
784 B
PHP

<?php
namespace MailPoet\Form;
use MailPoet\Entities\FormEntity;
class FormsRepositoryTest extends \MailPoetTest {
/** @var FormsRepository */
private $repository;
public function _before() {
parent::_before();
$this->repository = $this->diContainer->get(FormsRepository::class);
}
public function testItCanTrashForm() {
$form = $this->createForm('Form 1');
expect($form->getDeletedAt())->null();
$this->repository->trash($form);
expect($form->getDeletedAt())->notNull();
}
public function _after() {
$this->truncateEntity(FormEntity::class);
}
private function createForm(string $name): FormEntity {
$form = new FormEntity($name);
$this->repository->persist($form);
$this->repository->flush();
return $form;
}
}