1
0
mirror of synced 2024-11-22 03:46:02 +03:00

Several quick fixes

This commit is contained in:
Pavel 2019-06-24 09:34:59 +03:00
parent a04d4b0605
commit 8129a97000
5 changed files with 78 additions and 8 deletions

View File

@ -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;
}

View File

@ -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;
}
}

View File

@ -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;

View File

@ -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;

View File

@ -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);