Refactor Forms::trash() to use Doctrine

[MAILPOET-3039]
This commit is contained in:
Rodrigo Primo
2021-04-01 15:03:56 -03:00
committed by Veljko V
parent 86fa574ce8
commit e054f05222
4 changed files with 53 additions and 8 deletions

View File

@@ -212,12 +212,19 @@ class FormsTest extends \MailPoetTest {
$response = $this->endpoint->trash(['id' => $this->form2->getId()]);
expect($response->status)->equals(APIResponse::STATUS_OK);
expect($response->data)->equals(
$this->reloadForm((int)$this->form2->getId())->asArray()
$this->form2->toArray()
);
expect($response->data['deleted_at'])->notNull();
expect($response->meta['count'])->equals(1);
}
public function testErrorWhenTrashingNonExistentForm() {
$response = $this->endpoint->trash(['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 testItCanDeleteAForm() {
$response = $this->endpoint->delete(['id' => $this->form3->getId()]);
expect($response->data)->isEmpty();