diff --git a/src/Bot/Model/Entity/Channel/ChannelSettings.php b/src/Bot/Model/Entity/Channel/ChannelSettings.php index 57bd31c..d8a8310 100644 --- a/src/Bot/Model/Entity/Channel/ChannelSettings.php +++ b/src/Bot/Model/Entity/Channel/ChannelSettings.php @@ -38,9 +38,9 @@ class ChannelSettings private $status; /** - * @var int $spamAllowed + * @var bool $spamAllowed * - * @Type("int") + * @Type("bool") * @Accessor(getter="getStatus",setter="setStatus") */ private $spamAllowed; @@ -107,17 +107,17 @@ class ChannelSettings } /** - * @return int + * @return bool */ - public function getSpamAllowed(): int + public function isSpamAllowed(): bool { return $this->spamAllowed; } /** - * @param int $spamAllowed + * @param bool $spamAllowed */ - public function setSpamAllowed(int $spamAllowed) + public function setSpamAllowed(bool $spamAllowed): void { $this->spamAllowed = $spamAllowed; } diff --git a/src/Bot/Model/Entity/Channel/ChannelSettingsItem.php b/src/Bot/Model/Entity/Channel/ChannelSettingsItem.php index f9f24b9..608b466 100644 --- a/src/Bot/Model/Entity/Channel/ChannelSettingsItem.php +++ b/src/Bot/Model/Entity/Channel/ChannelSettingsItem.php @@ -74,6 +74,15 @@ class ChannelSettingsItem */ private $delivered; + /** + * @var int $maxCharsCount + * + * @Type("int") + * @Accessor(getter="getMaxCharsCount",setter="setMaxCharsCount") + * @SkipWhenEmpty() + */ + private $maxCharsCount; + /** * @var int $maxItemsCount * @@ -83,6 +92,15 @@ class ChannelSettingsItem */ private $maxItemsCount; + /** + * @var int $noteMaxCharsCount + * + * @Type("int") + * @Accessor(getter="getNoteMaxCharsCount", setter="setNoteMaxCharsCount") + * @SkipWhenEmpty() + */ + private $noteMaxCharsCount; + /** * @return string */ @@ -163,6 +181,22 @@ class ChannelSettingsItem $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 */ @@ -178,4 +212,20 @@ class ChannelSettingsItem { $this->maxItemsCount = $maxItemsCount; } + + /** + * @return int + */ + public function getNoteMaxCharsCount(): int + { + return $this->noteMaxCharsCount; + } + + /** + * @param int $noteMaxCharsCount + */ + public function setNoteMaxCharsCount(int $noteMaxCharsCount): void + { + $this->noteMaxCharsCount = $noteMaxCharsCount; + } } diff --git a/src/Bot/Model/Entity/Customer.php b/src/Bot/Model/Entity/Customer.php index 049b4f3..279300f 100644 --- a/src/Bot/Model/Entity/Customer.php +++ b/src/Bot/Model/Entity/Customer.php @@ -13,7 +13,7 @@ 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\SkipWhenEmpty; use JMS\Serializer\Annotation\Type; @@ -39,6 +39,8 @@ class Customer * @Type("string") * @Accessor(getter="getExternalId",setter="setExternalId") * @SkipWhenEmpty() + * @Assert\Length(max="64") + * @Assert\NotNull() */ private $externalId; @@ -57,6 +59,7 @@ class Customer * @Type("string") * @Accessor(getter="getUsername",setter="setUsername") * @SkipWhenEmpty() + * @Assert\Length(max="255") */ private $username; @@ -66,6 +69,7 @@ class Customer * @Type("string") * @Accessor(getter="getFirstName",setter="setFirstName") * @SkipWhenEmpty() + * @Assert\Length(max="255") */ private $firstName; @@ -75,6 +79,7 @@ class Customer * @Type("string") * @Accessor(getter="getLastName",setter="setLastName") * @SkipWhenEmpty() + * @Assert\Length(max="255") */ private $lastName; @@ -84,6 +89,7 @@ class Customer * @Type("string") * @Accessor(getter="getAvatarUrl",setter="setAvatarUrl") * @SkipWhenEmpty() + * @Assert\Length(max="255") */ private $avatarUrl; @@ -93,6 +99,7 @@ class Customer * @Type("string") * @Accessor(getter="getProfileUrl",setter="setProfileUrl") * @SkipWhenEmpty() + * @Assert\Length(max="255") */ private $profileUrl; @@ -111,6 +118,7 @@ class Customer * @Type("string") * @Accessor(getter="getCountry",setter="setCountry") * @SkipWhenEmpty() + * @Assert\Length(max="2") */ private $country; @@ -120,6 +128,7 @@ class Customer * @Type("string") * @Accessor(getter="getLanguage",setter="setLanguage") * @SkipWhenEmpty() + * @Assert\Length(max="20") */ private $language; @@ -129,6 +138,7 @@ class Customer * @Type("string") * @Accessor(getter="getPhone",setter="setPhone") * @SkipWhenEmpty() + * @Assert\Length(max="16") */ private $phone; @@ -138,6 +148,7 @@ class Customer * @Type("string") * @Accessor(getter="getEmail",setter="setEmail") * @SkipWhenEmpty() + * @Assert\Length(max="16") */ private $email; diff --git a/src/Bot/Model/Entity/User.php b/src/Bot/Model/Entity/User.php index 438483e..b3b3540 100644 --- a/src/Bot/Model/Entity/User.php +++ b/src/Bot/Model/Entity/User.php @@ -37,6 +37,7 @@ class User * @Type("string") * @Accessor(getter="getExternalId",setter="setExternalId") * @SkipWhenEmpty() + * @Assert\Length(max="64") */ private $externalId; @@ -73,6 +74,7 @@ class User * @Type("string") * @Accessor(getter="getUsername",setter="setUsername") * @SkipWhenEmpty() + * @Assert\Length(max="255") */ private $username; @@ -82,6 +84,7 @@ class User * @Type("string") * @Accessor(getter="getFirstName",setter="setFirstName") * @SkipWhenEmpty() + * @Assert\Length(max="255") */ private $firstName; @@ -91,6 +94,7 @@ class User * @Type("string") * @Accessor(getter="getLastName",setter="setLastName") * @SkipWhenEmpty() + * @Assert\Length(max="255") */ private $lastName; diff --git a/tests/Bot/Test/TestCase.php b/tests/Bot/Test/TestCase.php index c05f10e..6722555 100644 --- a/tests/Bot/Test/TestCase.php +++ b/tests/Bot/Test/TestCase.php @@ -100,7 +100,12 @@ class TestCase extends BaseCase */ 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)) { $json = file_get_contents($fileName);