Refactor Forms::duplicate() to use Doctrine instead of Paris

[MAILPOET-3038]
This commit is contained in:
Rodrigo Primo
2021-04-01 13:43:45 -03:00
committed by Veljko V
parent 3d2c62fc16
commit b3f82cccc5
5 changed files with 111 additions and 23 deletions

View File

@ -228,10 +228,10 @@ class FormsTest extends \MailPoetTest {
public function testItCanDuplicateAForm() {
$response = $this->endpoint->duplicate(['id' => $this->form1->getId()]);
expect($response->status)->equals(APIResponse::STATUS_OK);
$form = Form::where('name', 'Copy of Form 1')->findOne();
assert($form instanceof Form);
$form = $this->formsRepository->findOneBy(['name' => 'Copy of Form 1']);
$this->assertInstanceOf(FormEntity::class, $form);
expect($response->data)->equals(
$form->asArray()
$form->toArray()
);
expect($response->meta['count'])->equals(1);
}