Refactor Forms::restore() to use Doctrine

[MAILPOET-3039]
This commit is contained in:
Rodrigo Primo
2021-04-02 11:23:07 -03:00
committed by Veljko V
parent e054f05222
commit 49f0c054fd
4 changed files with 30 additions and 9 deletions

View File

@@ -202,12 +202,19 @@ class FormsTest extends \MailPoetTest {
$response = $this->endpoint->restore(['id' => $this->form1->getId()]);
expect($response->status)->equals(APIResponse::STATUS_OK);
expect($response->data)->equals(
$this->reloadForm((int)$this->form1->getId())->asArray()
$this->form1->toArray()
);
expect($response->data['deleted_at'])->null();
expect($response->meta['count'])->equals(1);
}
public function testErrorWhenRestoringNonExistentForm() {
$response = $this->endpoint->restore(['id' => 'Invalid ID']);
expect($response->errors[0]['error'])->equals('not_found');
expect($response->status)->equals(APIResponse::STATUS_NOT_FOUND);
expect($response->meta)->isEmpty();
}
public function testItCanTrashAForm() {
$response = $this->endpoint->trash(['id' => $this->form2->getId()]);
expect($response->status)->equals(APIResponse::STATUS_OK);