|
| 1 | +<?php declare(strict_types=1); |
| 2 | + |
| 3 | +namespace SupportPal\ApiClient\Tests\Unit\Model\Ticket\Request; |
| 4 | + |
| 5 | +use SupportPal\ApiClient\Model\Ticket\Request\CreateTicket; |
| 6 | +use SupportPal\ApiClient\Tests\Unit\Model\BaseModelTest; |
| 7 | + |
| 8 | +/** |
| 9 | + * @extends BaseModelTest<CreateTicket> |
| 10 | + */ |
| 11 | +class CreateTicketTest extends BaseModelTest |
| 12 | +{ |
| 13 | + protected string $modelClass = CreateTicket::class; |
| 14 | + |
| 15 | + public function testAddTag(): void |
| 16 | + { |
| 17 | + $this->model->addTag(1) |
| 18 | + ->addTag(1) |
| 19 | + ->addTag(5); |
| 20 | + |
| 21 | + self::assertSame(['tag' => [1, 5]], $this->model->toArray()); |
| 22 | + } |
| 23 | + |
| 24 | + public function testAssignOperator(): void |
| 25 | + { |
| 26 | + $this->model->assignOperator(23) |
| 27 | + ->assignOperator(2); |
| 28 | + |
| 29 | + self::assertSame(['assignedto' => [23, 2]], $this->model->toArray()); |
| 30 | + } |
| 31 | + |
| 32 | + public function testAddWatchingOperator(): void |
| 33 | + { |
| 34 | + $this->model->addWatchingOperator(5) |
| 35 | + ->addWatchingOperator(6) |
| 36 | + ->addWatchingOperator(4); |
| 37 | + |
| 38 | + self::assertSame(['watching' => [5, 6, 4]], $this->model->toArray()); |
| 39 | + } |
| 40 | + |
| 41 | + public function testSetCustomFieldValue(): void |
| 42 | + { |
| 43 | + $this->model->setCustomFieldValue(1, '2test') |
| 44 | + ->setCustomFieldValue(2, '2test2') |
| 45 | + ->setCustomFieldValue(1, '2test3'); |
| 46 | + |
| 47 | + self::assertSame(['customfield' => [1 => '2test3', 2 => '2test2']], $this->model->toArray()); |
| 48 | + } |
| 49 | + |
| 50 | + public function testAddCc(): void |
| 51 | + { |
| 52 | + $this-> model-> addCc( '[email protected]') |
| 53 | + |
| 54 | + |
| 55 | + |
| 56 | + self:: assertSame([ 'cc' => [ '[email protected]', '[email protected]']], $this-> model-> toArray()); |
| 57 | + } |
| 58 | + |
| 59 | + public function testAddAttachment(): void |
| 60 | + { |
| 61 | + $this->model->addAttachment('test', 'test') |
| 62 | + ->addAttachment('test', 'test') |
| 63 | + ->addAttachment('test2', 'test3'); |
| 64 | + |
| 65 | + self::assertSame([ |
| 66 | + 'attachment' => [ |
| 67 | + ['filename' => 'test', 'contents' => 'test'], |
| 68 | + ['filename' => 'test', 'contents' => 'test'], |
| 69 | + ['filename' => 'test2', 'contents' => 'test3'] |
| 70 | + ] |
| 71 | + ], $this->model->toArray()); |
| 72 | + } |
| 73 | +} |
0 commit comments