add using limit
in requests
This commit is contained in:
parent
1650ff34aa
commit
58aa909473
@ -23,6 +23,7 @@ use RetailCrm\Mg\Bot\Model\ModelInterface;
|
|||||||
class BotsRequest implements ModelInterface
|
class BotsRequest implements ModelInterface
|
||||||
{
|
{
|
||||||
use CommonFields;
|
use CommonFields;
|
||||||
|
use PageLimit;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Type("int")
|
* @Type("int")
|
||||||
|
@ -23,6 +23,7 @@ use RetailCrm\Mg\Bot\Model\ModelInterface;
|
|||||||
class ChannelsRequest implements ModelInterface
|
class ChannelsRequest implements ModelInterface
|
||||||
{
|
{
|
||||||
use CommonFields;
|
use CommonFields;
|
||||||
|
use PageLimit;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Type("array")
|
* @Type("array")
|
||||||
|
@ -23,6 +23,7 @@ use RetailCrm\Mg\Bot\Model\ModelInterface;
|
|||||||
class CustomersRequest implements ModelInterface
|
class CustomersRequest implements ModelInterface
|
||||||
{
|
{
|
||||||
use CommonFields;
|
use CommonFields;
|
||||||
|
use PageLimit;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Type("string")
|
* @Type("string")
|
||||||
|
@ -23,6 +23,7 @@ use RetailCrm\Mg\Bot\Model\ModelInterface;
|
|||||||
class DialogsRequest implements ModelInterface
|
class DialogsRequest implements ModelInterface
|
||||||
{
|
{
|
||||||
use CommonFields;
|
use CommonFields;
|
||||||
|
use PageLimit;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var int $chatId
|
* @var int $chatId
|
||||||
|
@ -22,6 +22,8 @@ use RetailCrm\Mg\Bot\Model\ModelInterface;
|
|||||||
*/
|
*/
|
||||||
class MembersRequest implements ModelInterface
|
class MembersRequest implements ModelInterface
|
||||||
{
|
{
|
||||||
|
use PageLimit;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var int $chatId
|
* @var int $chatId
|
||||||
*
|
*
|
||||||
|
@ -23,6 +23,7 @@ use RetailCrm\Mg\Bot\Model\ModelInterface;
|
|||||||
class UsersRequest implements ModelInterface
|
class UsersRequest implements ModelInterface
|
||||||
{
|
{
|
||||||
use CommonFields;
|
use CommonFields;
|
||||||
|
use PageLimit;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Type("string")
|
* @Type("string")
|
||||||
|
@ -10,6 +10,9 @@
|
|||||||
|
|
||||||
namespace RetailCrm\Mg\Bot\Tests;
|
namespace RetailCrm\Mg\Bot\Tests;
|
||||||
|
|
||||||
|
use Psr\Http\Message\ResponseInterface;
|
||||||
|
use RetailCrm\Mg\Bot\Client;
|
||||||
|
use RetailCrm\Mg\Bot\HttpClient;
|
||||||
use RetailCrm\Mg\Bot\Model\Constants;
|
use RetailCrm\Mg\Bot\Model\Constants;
|
||||||
use RetailCrm\Mg\Bot\Model\Entity\Channel;
|
use RetailCrm\Mg\Bot\Model\Entity\Channel;
|
||||||
use RetailCrm\Mg\Bot\Model\Entity\Chat\Chat;
|
use RetailCrm\Mg\Bot\Model\Entity\Chat\Chat;
|
||||||
|
57
tests/Bot/Tests/Model/ListEntityRequestTest.php
Normal file
57
tests/Bot/Tests/Model/ListEntityRequestTest.php
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace RetailCrm\Mg\Bot\Tests\Model;
|
||||||
|
|
||||||
|
use PHPStan\Testing\TestCase;
|
||||||
|
use RetailCrm\Common\Serializer;
|
||||||
|
use RetailCrm\Mg\Bot\Model\Request\BotsRequest;
|
||||||
|
use RetailCrm\Mg\Bot\Model\Request\ChannelsRequest;
|
||||||
|
use RetailCrm\Mg\Bot\Model\Request\ChatsRequest;
|
||||||
|
use RetailCrm\Mg\Bot\Model\Request\CustomersRequest;
|
||||||
|
use RetailCrm\Mg\Bot\Model\Request\DialogsRequest;
|
||||||
|
use RetailCrm\Mg\Bot\Model\Request\MembersRequest;
|
||||||
|
use RetailCrm\Mg\Bot\Model\Request\UsersRequest;
|
||||||
|
|
||||||
|
class ListEntityRequestTest extends TestCase
|
||||||
|
{
|
||||||
|
private const LIMIT = 100;
|
||||||
|
|
||||||
|
public function testListRequestsWithLimit(): void
|
||||||
|
{
|
||||||
|
$expected = json_encode(['limit' => self::LIMIT]);
|
||||||
|
$request = new BotsRequest();
|
||||||
|
$request->setLimit(self::LIMIT);
|
||||||
|
|
||||||
|
self::assertEquals($expected, Serializer::serialize($request));
|
||||||
|
|
||||||
|
$request = new ChannelsRequest();
|
||||||
|
$request->setLimit(self::LIMIT);
|
||||||
|
|
||||||
|
self::assertEquals($expected, Serializer::serialize($request));
|
||||||
|
|
||||||
|
$request = new ChatsRequest();
|
||||||
|
$request->setLimit(self::LIMIT);
|
||||||
|
|
||||||
|
self::assertEquals($expected, Serializer::serialize($request));
|
||||||
|
|
||||||
|
$request = new CustomersRequest();
|
||||||
|
$request->setLimit(self::LIMIT);
|
||||||
|
|
||||||
|
self::assertEquals($expected, Serializer::serialize($request));
|
||||||
|
|
||||||
|
$request = new DialogsRequest();
|
||||||
|
$request->setLimit(self::LIMIT);
|
||||||
|
|
||||||
|
self::assertEquals($expected, Serializer::serialize($request));
|
||||||
|
|
||||||
|
$request = new MembersRequest();
|
||||||
|
$request->setLimit(self::LIMIT);
|
||||||
|
|
||||||
|
self::assertEquals($expected, Serializer::serialize($request));
|
||||||
|
|
||||||
|
$request = new UsersRequest();
|
||||||
|
$request->setLimit(self::LIMIT);
|
||||||
|
|
||||||
|
self::assertEquals($expected, Serializer::serialize($request));
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user