Add check on list type

[MAILPOET-4752]
This commit is contained in:
Jan Lysý
2022-10-31 15:06:58 +01:00
committed by Aschepikov
parent f231f3dc6d
commit ad46d05c6b
4 changed files with 40 additions and 8 deletions

View File

@@ -168,6 +168,18 @@ class SegmentsTest extends \MailPoetTest {
expect($result['description'])->equals($data['description']);
}
public function testItDoesNotAllowUpdateWPSegment(): void {
$wpSegment = $this->segmentsRepository->getWPUsersSegment();
$this->assertInstanceOf(SegmentEntity::class, $wpSegment);
try {
$this->getApi()->updateList(['id' => $wpSegment->getId(), 'name' => 'Test']);
$this->fail('WP list cannot be updated.');
} catch (\Exception $e) {
expect($e->getMessage())->equals('List of the type \'' . $wpSegment->getType() . '\' is not supported for this action.');
expect($e->getCode())->equals(APIException::LIST_TYPE_IS_NOT_SUPPORTED);
}
}
public function testItRequiresIdToDeleteList(): void {
try {
$this->getApi()->deleteList('');