Several quick fixes
This commit is contained in:
parent
a04d4b0605
commit
8129a97000
@ -38,9 +38,9 @@ class ChannelSettings
|
|||||||
private $status;
|
private $status;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var int $spamAllowed
|
* @var bool $spamAllowed
|
||||||
*
|
*
|
||||||
* @Type("int")
|
* @Type("bool")
|
||||||
* @Accessor(getter="getStatus",setter="setStatus")
|
* @Accessor(getter="getStatus",setter="setStatus")
|
||||||
*/
|
*/
|
||||||
private $spamAllowed;
|
private $spamAllowed;
|
||||||
@ -107,17 +107,17 @@ class ChannelSettings
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return int
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function getSpamAllowed(): int
|
public function isSpamAllowed(): bool
|
||||||
{
|
{
|
||||||
return $this->spamAllowed;
|
return $this->spamAllowed;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param int $spamAllowed
|
* @param bool $spamAllowed
|
||||||
*/
|
*/
|
||||||
public function setSpamAllowed(int $spamAllowed)
|
public function setSpamAllowed(bool $spamAllowed): void
|
||||||
{
|
{
|
||||||
$this->spamAllowed = $spamAllowed;
|
$this->spamAllowed = $spamAllowed;
|
||||||
}
|
}
|
||||||
|
@ -74,6 +74,15 @@ class ChannelSettingsItem
|
|||||||
*/
|
*/
|
||||||
private $delivered;
|
private $delivered;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var int $maxCharsCount
|
||||||
|
*
|
||||||
|
* @Type("int")
|
||||||
|
* @Accessor(getter="getMaxCharsCount",setter="setMaxCharsCount")
|
||||||
|
* @SkipWhenEmpty()
|
||||||
|
*/
|
||||||
|
private $maxCharsCount;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var int $maxItemsCount
|
* @var int $maxItemsCount
|
||||||
*
|
*
|
||||||
@ -83,6 +92,15 @@ class ChannelSettingsItem
|
|||||||
*/
|
*/
|
||||||
private $maxItemsCount;
|
private $maxItemsCount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var int $noteMaxCharsCount
|
||||||
|
*
|
||||||
|
* @Type("int")
|
||||||
|
* @Accessor(getter="getNoteMaxCharsCount", setter="setNoteMaxCharsCount")
|
||||||
|
* @SkipWhenEmpty()
|
||||||
|
*/
|
||||||
|
private $noteMaxCharsCount;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
@ -163,6 +181,22 @@ class ChannelSettingsItem
|
|||||||
$this->delivered = $delivered;
|
$this->delivered = $delivered;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
public function getMaxCharsCount(): int
|
||||||
|
{
|
||||||
|
return $this->maxCharsCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param int $maxCharsCount
|
||||||
|
*/
|
||||||
|
public function setMaxCharsCount(int $maxCharsCount): void
|
||||||
|
{
|
||||||
|
$this->maxCharsCount = $maxCharsCount;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
@ -178,4 +212,20 @@ class ChannelSettingsItem
|
|||||||
{
|
{
|
||||||
$this->maxItemsCount = $maxItemsCount;
|
$this->maxItemsCount = $maxItemsCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
public function getNoteMaxCharsCount(): int
|
||||||
|
{
|
||||||
|
return $this->noteMaxCharsCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param int $noteMaxCharsCount
|
||||||
|
*/
|
||||||
|
public function setNoteMaxCharsCount(int $noteMaxCharsCount): void
|
||||||
|
{
|
||||||
|
$this->noteMaxCharsCount = $noteMaxCharsCount;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
namespace RetailCrm\Mg\Bot\Model\Entity;
|
namespace RetailCrm\Mg\Bot\Model\Entity;
|
||||||
|
|
||||||
use RetailCrm\Mg\Bot\Model\Entity\CommonFields;
|
use Symfony\Component\Validator\Constraints as Assert;
|
||||||
use JMS\Serializer\Annotation\Accessor;
|
use JMS\Serializer\Annotation\Accessor;
|
||||||
use JMS\Serializer\Annotation\SkipWhenEmpty;
|
use JMS\Serializer\Annotation\SkipWhenEmpty;
|
||||||
use JMS\Serializer\Annotation\Type;
|
use JMS\Serializer\Annotation\Type;
|
||||||
@ -39,6 +39,8 @@ class Customer
|
|||||||
* @Type("string")
|
* @Type("string")
|
||||||
* @Accessor(getter="getExternalId",setter="setExternalId")
|
* @Accessor(getter="getExternalId",setter="setExternalId")
|
||||||
* @SkipWhenEmpty()
|
* @SkipWhenEmpty()
|
||||||
|
* @Assert\Length(max="64")
|
||||||
|
* @Assert\NotNull()
|
||||||
*/
|
*/
|
||||||
private $externalId;
|
private $externalId;
|
||||||
|
|
||||||
@ -57,6 +59,7 @@ class Customer
|
|||||||
* @Type("string")
|
* @Type("string")
|
||||||
* @Accessor(getter="getUsername",setter="setUsername")
|
* @Accessor(getter="getUsername",setter="setUsername")
|
||||||
* @SkipWhenEmpty()
|
* @SkipWhenEmpty()
|
||||||
|
* @Assert\Length(max="255")
|
||||||
*/
|
*/
|
||||||
private $username;
|
private $username;
|
||||||
|
|
||||||
@ -66,6 +69,7 @@ class Customer
|
|||||||
* @Type("string")
|
* @Type("string")
|
||||||
* @Accessor(getter="getFirstName",setter="setFirstName")
|
* @Accessor(getter="getFirstName",setter="setFirstName")
|
||||||
* @SkipWhenEmpty()
|
* @SkipWhenEmpty()
|
||||||
|
* @Assert\Length(max="255")
|
||||||
*/
|
*/
|
||||||
private $firstName;
|
private $firstName;
|
||||||
|
|
||||||
@ -75,6 +79,7 @@ class Customer
|
|||||||
* @Type("string")
|
* @Type("string")
|
||||||
* @Accessor(getter="getLastName",setter="setLastName")
|
* @Accessor(getter="getLastName",setter="setLastName")
|
||||||
* @SkipWhenEmpty()
|
* @SkipWhenEmpty()
|
||||||
|
* @Assert\Length(max="255")
|
||||||
*/
|
*/
|
||||||
private $lastName;
|
private $lastName;
|
||||||
|
|
||||||
@ -84,6 +89,7 @@ class Customer
|
|||||||
* @Type("string")
|
* @Type("string")
|
||||||
* @Accessor(getter="getAvatarUrl",setter="setAvatarUrl")
|
* @Accessor(getter="getAvatarUrl",setter="setAvatarUrl")
|
||||||
* @SkipWhenEmpty()
|
* @SkipWhenEmpty()
|
||||||
|
* @Assert\Length(max="255")
|
||||||
*/
|
*/
|
||||||
private $avatarUrl;
|
private $avatarUrl;
|
||||||
|
|
||||||
@ -93,6 +99,7 @@ class Customer
|
|||||||
* @Type("string")
|
* @Type("string")
|
||||||
* @Accessor(getter="getProfileUrl",setter="setProfileUrl")
|
* @Accessor(getter="getProfileUrl",setter="setProfileUrl")
|
||||||
* @SkipWhenEmpty()
|
* @SkipWhenEmpty()
|
||||||
|
* @Assert\Length(max="255")
|
||||||
*/
|
*/
|
||||||
private $profileUrl;
|
private $profileUrl;
|
||||||
|
|
||||||
@ -111,6 +118,7 @@ class Customer
|
|||||||
* @Type("string")
|
* @Type("string")
|
||||||
* @Accessor(getter="getCountry",setter="setCountry")
|
* @Accessor(getter="getCountry",setter="setCountry")
|
||||||
* @SkipWhenEmpty()
|
* @SkipWhenEmpty()
|
||||||
|
* @Assert\Length(max="2")
|
||||||
*/
|
*/
|
||||||
private $country;
|
private $country;
|
||||||
|
|
||||||
@ -120,6 +128,7 @@ class Customer
|
|||||||
* @Type("string")
|
* @Type("string")
|
||||||
* @Accessor(getter="getLanguage",setter="setLanguage")
|
* @Accessor(getter="getLanguage",setter="setLanguage")
|
||||||
* @SkipWhenEmpty()
|
* @SkipWhenEmpty()
|
||||||
|
* @Assert\Length(max="20")
|
||||||
*/
|
*/
|
||||||
private $language;
|
private $language;
|
||||||
|
|
||||||
@ -129,6 +138,7 @@ class Customer
|
|||||||
* @Type("string")
|
* @Type("string")
|
||||||
* @Accessor(getter="getPhone",setter="setPhone")
|
* @Accessor(getter="getPhone",setter="setPhone")
|
||||||
* @SkipWhenEmpty()
|
* @SkipWhenEmpty()
|
||||||
|
* @Assert\Length(max="16")
|
||||||
*/
|
*/
|
||||||
private $phone;
|
private $phone;
|
||||||
|
|
||||||
@ -138,6 +148,7 @@ class Customer
|
|||||||
* @Type("string")
|
* @Type("string")
|
||||||
* @Accessor(getter="getEmail",setter="setEmail")
|
* @Accessor(getter="getEmail",setter="setEmail")
|
||||||
* @SkipWhenEmpty()
|
* @SkipWhenEmpty()
|
||||||
|
* @Assert\Length(max="16")
|
||||||
*/
|
*/
|
||||||
private $email;
|
private $email;
|
||||||
|
|
||||||
|
@ -37,6 +37,7 @@ class User
|
|||||||
* @Type("string")
|
* @Type("string")
|
||||||
* @Accessor(getter="getExternalId",setter="setExternalId")
|
* @Accessor(getter="getExternalId",setter="setExternalId")
|
||||||
* @SkipWhenEmpty()
|
* @SkipWhenEmpty()
|
||||||
|
* @Assert\Length(max="64")
|
||||||
*/
|
*/
|
||||||
private $externalId;
|
private $externalId;
|
||||||
|
|
||||||
@ -73,6 +74,7 @@ class User
|
|||||||
* @Type("string")
|
* @Type("string")
|
||||||
* @Accessor(getter="getUsername",setter="setUsername")
|
* @Accessor(getter="getUsername",setter="setUsername")
|
||||||
* @SkipWhenEmpty()
|
* @SkipWhenEmpty()
|
||||||
|
* @Assert\Length(max="255")
|
||||||
*/
|
*/
|
||||||
private $username;
|
private $username;
|
||||||
|
|
||||||
@ -82,6 +84,7 @@ class User
|
|||||||
* @Type("string")
|
* @Type("string")
|
||||||
* @Accessor(getter="getFirstName",setter="setFirstName")
|
* @Accessor(getter="getFirstName",setter="setFirstName")
|
||||||
* @SkipWhenEmpty()
|
* @SkipWhenEmpty()
|
||||||
|
* @Assert\Length(max="255")
|
||||||
*/
|
*/
|
||||||
private $firstName;
|
private $firstName;
|
||||||
|
|
||||||
@ -91,6 +94,7 @@ class User
|
|||||||
* @Type("string")
|
* @Type("string")
|
||||||
* @Accessor(getter="getLastName",setter="setLastName")
|
* @Accessor(getter="getLastName",setter="setLastName")
|
||||||
* @SkipWhenEmpty()
|
* @SkipWhenEmpty()
|
||||||
|
* @Assert\Length(max="255")
|
||||||
*/
|
*/
|
||||||
private $lastName;
|
private $lastName;
|
||||||
|
|
||||||
|
@ -100,7 +100,12 @@ class TestCase extends BaseCase
|
|||||||
*/
|
*/
|
||||||
public function getJsonResponse(string $jsonFile, int $statusCode = 200)
|
public function getJsonResponse(string $jsonFile, int $statusCode = 200)
|
||||||
{
|
{
|
||||||
$fileName = realpath(join(DIRECTORY_SEPARATOR, [__DIR__, '..', '..', 'Resources', "${jsonFile}.json"]));
|
$fileName = realpath(
|
||||||
|
join(
|
||||||
|
DIRECTORY_SEPARATOR,
|
||||||
|
[__DIR__, '..', '..', 'Resources', \sprintf('%s.json', $jsonFile)]
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
if (file_exists($fileName)) {
|
if (file_exists($fileName)) {
|
||||||
$json = file_get_contents($fileName);
|
$json = file_get_contents($fileName);
|
||||||
|
Loading…
Reference in New Issue
Block a user