Мелкофиксы
- `Ffd105Tags::CLIENT_CONTACTS` => `CLIENT_PHONE_EMAIL` + мелочи по `Client`, `ClientTest` и `PayingAgentTest`
This commit is contained in:
@@ -17,8 +17,7 @@ use AtolOnline\{
|
|||||||
Exceptions\InvalidInnLengthException,
|
Exceptions\InvalidInnLengthException,
|
||||||
Exceptions\TooLongClientContactException,
|
Exceptions\TooLongClientContactException,
|
||||||
Exceptions\TooLongClientNameException,
|
Exceptions\TooLongClientNameException,
|
||||||
Exceptions\TooLongEmailException
|
Exceptions\TooLongEmailException};
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Класс Client, описывающий сущность покупателя
|
* Класс Client, описывающий сущность покупателя
|
||||||
@@ -28,22 +27,22 @@ use AtolOnline\{
|
|||||||
class Client extends Entity
|
class Client extends Entity
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @var string|null Наименование. Тег ФФД - 1227.
|
* @var string|null Наименование (1227)
|
||||||
*/
|
*/
|
||||||
protected ?string $name = null;
|
protected ?string $name = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string|null Email. Тег ФФД - 1008.
|
* @var string|null Email (1008)
|
||||||
*/
|
*/
|
||||||
protected ?string $email = null;
|
protected ?string $email = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string|null Телефон покупателя. Тег ФФД - 1008.
|
* @var string|null Телефон (1008)
|
||||||
*/
|
*/
|
||||||
protected ?string $phone = null;
|
protected ?string $phone = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string|null ИНН. Тег ФФД - 1228.
|
* @var string|null ИНН (1228)
|
||||||
*/
|
*/
|
||||||
protected ?string $inn = null;
|
protected ?string $inn = null;
|
||||||
|
|
||||||
@@ -52,7 +51,7 @@ class Client extends Entity
|
|||||||
*
|
*
|
||||||
* @param string|null $name Наименование (1227)
|
* @param string|null $name Наименование (1227)
|
||||||
* @param string|null $phone Email (1008)
|
* @param string|null $phone Email (1008)
|
||||||
* @param string|null $email Телефон покупателя (1008)
|
* @param string|null $email Телефон (1008)
|
||||||
* @param string|null $inn ИНН (1228)
|
* @param string|null $inn ИНН (1228)
|
||||||
* @throws TooLongClientNameException
|
* @throws TooLongClientNameException
|
||||||
* @throws TooLongClientContactException
|
* @throws TooLongClientContactException
|
||||||
@@ -65,8 +64,7 @@ class Client extends Entity
|
|||||||
?string $email = null,
|
?string $email = null,
|
||||||
?string $phone = null,
|
?string $phone = null,
|
||||||
?string $inn = null
|
?string $inn = null
|
||||||
)
|
) {
|
||||||
{
|
|
||||||
!is_null($name) && $this->setName($name);
|
!is_null($name) && $this->setName($name);
|
||||||
!is_null($email) && $this->setEmail($email);
|
!is_null($email) && $this->setEmail($email);
|
||||||
!is_null($phone) && $this->setPhone($phone);
|
!is_null($phone) && $this->setPhone($phone);
|
||||||
@@ -76,8 +74,6 @@ class Client extends Entity
|
|||||||
/**
|
/**
|
||||||
* Возвращает наименование покупателя
|
* Возвращает наименование покупателя
|
||||||
*
|
*
|
||||||
* Тег ФФД - 1227
|
|
||||||
*
|
|
||||||
* @return string|null
|
* @return string|null
|
||||||
*/
|
*/
|
||||||
public function getName(): ?string
|
public function getName(): ?string
|
||||||
@@ -88,8 +84,6 @@ class Client extends Entity
|
|||||||
/**
|
/**
|
||||||
* Устанавливает наименование покупателя
|
* Устанавливает наименование покупателя
|
||||||
*
|
*
|
||||||
* Тег ФФД - 1227
|
|
||||||
*
|
|
||||||
* @todo улучшить валидацию по Constraints::PATTERN_PHONE
|
* @todo улучшить валидацию по Constraints::PATTERN_PHONE
|
||||||
* @param string|null $name
|
* @param string|null $name
|
||||||
* @return $this
|
* @return $this
|
||||||
@@ -142,8 +136,6 @@ class Client extends Entity
|
|||||||
/**
|
/**
|
||||||
* Возвращает установленный телефон
|
* Возвращает установленный телефон
|
||||||
*
|
*
|
||||||
* Тег ФФД - 1008
|
|
||||||
*
|
|
||||||
* @return string|null
|
* @return string|null
|
||||||
*/
|
*/
|
||||||
public function getPhone(): ?string
|
public function getPhone(): ?string
|
||||||
@@ -154,8 +146,6 @@ class Client extends Entity
|
|||||||
/**
|
/**
|
||||||
* Устанавливает телефон
|
* Устанавливает телефон
|
||||||
*
|
*
|
||||||
* Тег ФФД - 1008
|
|
||||||
*
|
|
||||||
* @param string|null $phone Номер телефона
|
* @param string|null $phone Номер телефона
|
||||||
* @return $this
|
* @return $this
|
||||||
* @throws TooLongClientContactException
|
* @throws TooLongClientContactException
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ class EmptyEmailException extends AtolException
|
|||||||
{
|
{
|
||||||
protected $message = 'Email не может быть пустым';
|
protected $message = 'Email не может быть пустым';
|
||||||
protected array $ffd_tags = [
|
protected array $ffd_tags = [
|
||||||
Ffd105Tags::CLIENT_CONTACT,
|
Ffd105Tags::CLIENT_PHONE_EMAIL,
|
||||||
Ffd105Tags::COMPANY_EMAIL,
|
Ffd105Tags::COMPANY_EMAIL,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ use AtolOnline\Constants\Ffd105Tags;
|
|||||||
class InvalidEmailException extends AtolException
|
class InvalidEmailException extends AtolException
|
||||||
{
|
{
|
||||||
protected array $ffd_tags = [
|
protected array $ffd_tags = [
|
||||||
Ffd105Tags::CLIENT_CONTACT,
|
Ffd105Tags::CLIENT_PHONE_EMAIL,
|
||||||
Ffd105Tags::COMPANY_EMAIL,
|
Ffd105Tags::COMPANY_EMAIL,
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ use AtolOnline\Constants\Ffd105Tags;
|
|||||||
class InvalidPhoneException extends AtolException
|
class InvalidPhoneException extends AtolException
|
||||||
{
|
{
|
||||||
protected array $ffd_tags = [
|
protected array $ffd_tags = [
|
||||||
Ffd105Tags::CLIENT_CONTACT,
|
Ffd105Tags::CLIENT_PHONE_EMAIL,
|
||||||
Ffd105Tags::PAGENT_PHONE,
|
Ffd105Tags::PAGENT_PHONE,
|
||||||
Ffd105Tags::RPO_PHONES,
|
Ffd105Tags::RPO_PHONES,
|
||||||
Ffd105Tags::MTO_PHONES,
|
Ffd105Tags::MTO_PHONES,
|
||||||
|
|||||||
@@ -21,5 +21,5 @@ class TooLongClientContactException extends TooLongException
|
|||||||
{
|
{
|
||||||
protected $message = 'Cлишком длинный телефон или email покупателя';
|
protected $message = 'Cлишком длинный телефон или email покупателя';
|
||||||
protected float $max = Constraints::MAX_LENGTH_CLIENT_CONTACT;
|
protected float $max = Constraints::MAX_LENGTH_CLIENT_CONTACT;
|
||||||
protected array $ffd_tags = [Ffd105Tags::CLIENT_CONTACT];
|
protected array $ffd_tags = [Ffd105Tags::CLIENT_PHONE_EMAIL];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ class TooLongEmailException extends TooLongException
|
|||||||
protected $message = 'Слишком длинный email';
|
protected $message = 'Слишком длинный email';
|
||||||
protected float $max = Constraints::MAX_LENGTH_EMAIL;
|
protected float $max = Constraints::MAX_LENGTH_EMAIL;
|
||||||
protected array $ffd_tags = [
|
protected array $ffd_tags = [
|
||||||
Ffd105Tags::CLIENT_CONTACT,
|
Ffd105Tags::CLIENT_PHONE_EMAIL,
|
||||||
Ffd105Tags::COMPANY_EMAIL,
|
Ffd105Tags::COMPANY_EMAIL,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,8 +17,7 @@ use AtolOnline\{
|
|||||||
Exceptions\TooLongClientNameException,
|
Exceptions\TooLongClientNameException,
|
||||||
Exceptions\TooLongEmailException,
|
Exceptions\TooLongEmailException,
|
||||||
Helpers,
|
Helpers,
|
||||||
Tests\BasicTestCase
|
Tests\BasicTestCase};
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Набор тестов для проверки работы класса покупателя
|
* Набор тестов для проверки работы класса покупателя
|
||||||
@@ -111,8 +110,6 @@ class ClientTest extends BasicTestCase
|
|||||||
(new Client())->setName(Helpers::randomStr(400));
|
(new Client())->setName(Helpers::randomStr(400));
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Тестирует установку телефонов, которые приводятся к null
|
* Тестирует установку телефонов, которые приводятся к null
|
||||||
*
|
*
|
||||||
@@ -158,8 +155,6 @@ class ClientTest extends BasicTestCase
|
|||||||
(new Client())->setPhone('99999999999999999999999999999999999999999999999999999999999999999999999999');
|
(new Client())->setPhone('99999999999999999999999999999999999999999999999999999999999999999999999999');
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Тестирует установку валидных email-ов
|
* Тестирует установку валидных email-ов
|
||||||
*
|
*
|
||||||
@@ -208,8 +203,6 @@ class ClientTest extends BasicTestCase
|
|||||||
(new Client())->setEmail($email);
|
(new Client())->setEmail($email);
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Тестирует исключение о корректной длине ИНН
|
* Тестирует исключение о корректной длине ИНН
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -67,16 +67,17 @@ class PayingAgentTest extends BasicTestCase
|
|||||||
/**
|
/**
|
||||||
* Тестирует установку операций, которые приводятся к null
|
* Тестирует установку операций, которые приводятся к null
|
||||||
*
|
*
|
||||||
* @param mixed $name
|
* @param mixed $operation
|
||||||
* @dataProvider providerNullableStrings
|
* @dataProvider providerNullableStrings
|
||||||
* @covers \AtolOnline\Entities\PayingAgent
|
* @covers \AtolOnline\Entities\PayingAgent
|
||||||
* @covers \AtolOnline\Entities\PayingAgent::setOperation
|
* @covers \AtolOnline\Entities\PayingAgent::setOperation
|
||||||
* @covers \AtolOnline\Entities\PayingAgent::getOperation
|
* @covers \AtolOnline\Entities\PayingAgent::getOperation
|
||||||
* @throws TooLongPayingAgentOperationException
|
* @throws TooLongPayingAgentOperationException
|
||||||
|
* @throws InvalidPhoneException
|
||||||
*/
|
*/
|
||||||
public function testNullableOperations(mixed $name): void
|
public function testNullableOperations(mixed $operation): void
|
||||||
{
|
{
|
||||||
$this->assertNull((new PayingAgent())->setOperation($name)->getOperation());
|
$this->assertNull((new PayingAgent($operation))->getOperation());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user