1
0
mirror of synced 2024-11-22 05:16:07 +03:00
This commit is contained in:
Uryvskiy Dima 2024-01-16 18:09:05 +03:00
parent f926b59e36
commit f37434af17
6 changed files with 60 additions and 1 deletions

View File

@ -9,6 +9,8 @@
namespace RetailCrm\Api\Model\Entity\Tasks; namespace RetailCrm\Api\Model\Entity\Tasks;
use RetailCrm\Api\Component\Serializer\Annotation as JMS;
class TaskComment class TaskComment
{ {
/** /**

View File

@ -9,6 +9,9 @@
namespace RetailCrm\Api\Model\Entity\Tasks; namespace RetailCrm\Api\Model\Entity\Tasks;
use DateTime;
use RetailCrm\Api\Component\Serializer\Annotation as JMS;
/** /**
* Class TaskHistory * Class TaskHistory
* *

View File

@ -10,6 +10,7 @@
namespace RetailCrm\Api\Model\Filter\Tasks; namespace RetailCrm\Api\Model\Filter\Tasks;
use DateTime; use DateTime;
use RetailCrm\Api\Component\FormData\Mapping as Form;
/** /**
* Class TaskHistoryFilter * Class TaskHistoryFilter

View File

@ -12,10 +12,10 @@ namespace RetailCrm\Api\Model\Request\Tasks;
use RetailCrm\Api\Interfaces\RequestInterface; use RetailCrm\Api\Interfaces\RequestInterface;
use RetailCrm\Api\Model\Filter\Tasks\TaskHistoryFilter; use RetailCrm\Api\Model\Filter\Tasks\TaskHistoryFilter;
use RetailCrm\Api\Model\Request\Traits\HistoryPageLimitTrait; use RetailCrm\Api\Model\Request\Traits\HistoryPageLimitTrait;
use RetailCrm\Api\Component\FormData\Mapping as Form;
class TaskHistoryRequest implements RequestInterface class TaskHistoryRequest implements RequestInterface
{ {
use HistoryPageLimitTrait; use HistoryPageLimitTrait;
/** /**

View File

@ -12,6 +12,7 @@ namespace RetailCrm\Api\Model\Response\Tasks;
use DateTime; use DateTime;
use RetailCrm\Api\Component\Serializer\Annotation as JMS; use RetailCrm\Api\Component\Serializer\Annotation as JMS;
use RetailCrm\Api\Model\Response\AbstractPaginatedResponse; use RetailCrm\Api\Model\Response\AbstractPaginatedResponse;
class TasksHistoryResponse extends AbstractPaginatedResponse class TasksHistoryResponse extends AbstractPaginatedResponse
{ {
/** /**

View File

@ -14,6 +14,8 @@ use RetailCrm\Api\Enum\Tasks\TaskStatus;
use RetailCrm\Api\Model\Entity\Tasks\AbstractCustomer; use RetailCrm\Api\Model\Entity\Tasks\AbstractCustomer;
use RetailCrm\Api\Model\Entity\Tasks\Task; use RetailCrm\Api\Model\Entity\Tasks\Task;
use RetailCrm\Api\Model\Filter\Tasks\TaskFilter; use RetailCrm\Api\Model\Filter\Tasks\TaskFilter;
use RetailCrm\Api\Model\Filter\Tasks\TaskHistoryFilter;
use RetailCrm\Api\Model\Request\Tasks\TaskHistoryRequest;
use RetailCrm\Api\Model\Request\Tasks\TasksCreateRequest; use RetailCrm\Api\Model\Request\Tasks\TasksCreateRequest;
use RetailCrm\Api\Model\Request\Tasks\TasksRequest; use RetailCrm\Api\Model\Request\Tasks\TasksRequest;
use RetailCrm\TestUtils\Factory\TestClientFactory; use RetailCrm\TestUtils\Factory\TestClientFactory;
@ -175,4 +177,54 @@ EOF;
self::assertModelEqualsToResponse($json, $response); self::assertModelEqualsToResponse($json, $response);
} }
public function testHistory(): void
{
$json = <<<'EOF'
{
"success":true,
"history":[
{
"id":1,
"createdAt":"2023-03-22 19:00:29",
"created":true,
"source":"rule",
"field":"id",
"oldValue":null,
"newValue":1,
"task":{
"id":95978,
"text":"",
"commentary":"",
"createdAt":"2023-03-22 19:00:29",
"complete":false,
"performer":116,
"performerType":"user",
"customer":{
"type":"customer",
"id":1
}
}
}
]
}
EOF;
$mock = static::createApiMockBuilder('tasks/1');
$mock->matchMethod(RequestMethod::GET)
->reply(200)
->withBody($json);
$client = TestClientFactory::createClient($mock->getClient());
$request = new TaskHistoryRequest();
$request->limit = 100;
$request->page = 1;
$request->filter = new TaskHistoryFilter();
$request->filter->sinceId = 1;
$response = $client->tasks->history($request);
self::assertModelEqualsToResponse($json, $response);
}
} }