Мелкофиксы

- `Ffd105Tags::CLIENT_CONTACTS` => `CLIENT_PHONE_EMAIL`
+ мелочи по `Client`, `ClientTest` и `PayingAgentTest`
pull/10/head
Anthony Axenov 2021-11-24 18:55:53 +08:00
parent 95dbc3a5b7
commit 8b79b2be51
8 changed files with 17 additions and 33 deletions

View File

@ -17,8 +17,7 @@ use AtolOnline\{
Exceptions\InvalidInnLengthException,
Exceptions\TooLongClientContactException,
Exceptions\TooLongClientNameException,
Exceptions\TooLongEmailException
};
Exceptions\TooLongEmailException};
/**
* Класс Client, описывающий сущность покупателя
@ -28,22 +27,22 @@ use AtolOnline\{
class Client extends Entity
{
/**
* @var string|null Наименование. Тег ФФД - 1227.
* @var string|null Наименование (1227)
*/
protected ?string $name = null;
/**
* @var string|null Email. Тег ФФД - 1008.
* @var string|null Email (1008)
*/
protected ?string $email = null;
/**
* @var string|null Телефон покупателя. Тег ФФД - 1008.
* @var string|null Телефон (1008)
*/
protected ?string $phone = null;
/**
* @var string|null ИНН. Тег ФФД - 1228.
* @var string|null ИНН (1228)
*/
protected ?string $inn = null;
@ -52,7 +51,7 @@ class Client extends Entity
*
* @param string|null $name Наименование (1227)
* @param string|null $phone Email (1008)
* @param string|null $email Телефон покупателя (1008)
* @param string|null $email Телефон (1008)
* @param string|null $inn ИНН (1228)
* @throws TooLongClientNameException
* @throws TooLongClientContactException
@ -65,8 +64,7 @@ class Client extends Entity
?string $email = null,
?string $phone = null,
?string $inn = null
)
{
) {
!is_null($name) && $this->setName($name);
!is_null($email) && $this->setEmail($email);
!is_null($phone) && $this->setPhone($phone);
@ -76,8 +74,6 @@ class Client extends Entity
/**
* Возвращает наименование покупателя
*
* Тег ФФД - 1227
*
* @return string|null
*/
public function getName(): ?string
@ -88,8 +84,6 @@ class Client extends Entity
/**
* Устанавливает наименование покупателя
*
* Тег ФФД - 1227
*
* @todo улучшить валидацию по Constraints::PATTERN_PHONE
* @param string|null $name
* @return $this
@ -142,8 +136,6 @@ class Client extends Entity
/**
* Возвращает установленный телефон
*
* Тег ФФД - 1008
*
* @return string|null
*/
public function getPhone(): ?string
@ -154,8 +146,6 @@ class Client extends Entity
/**
* Устанавливает телефон
*
* Тег ФФД - 1008
*
* @param string|null $phone Номер телефона
* @return $this
* @throws TooLongClientContactException

View File

@ -22,7 +22,7 @@ class EmptyEmailException extends AtolException
{
protected $message = 'Email не может быть пустым';
protected array $ffd_tags = [
Ffd105Tags::CLIENT_CONTACT,
Ffd105Tags::CLIENT_PHONE_EMAIL,
Ffd105Tags::COMPANY_EMAIL,
];
}

View File

@ -21,7 +21,7 @@ use AtolOnline\Constants\Ffd105Tags;
class InvalidEmailException extends AtolException
{
protected array $ffd_tags = [
Ffd105Tags::CLIENT_CONTACT,
Ffd105Tags::CLIENT_PHONE_EMAIL,
Ffd105Tags::COMPANY_EMAIL,
];

View File

@ -19,7 +19,7 @@ use AtolOnline\Constants\Ffd105Tags;
class InvalidPhoneException extends AtolException
{
protected array $ffd_tags = [
Ffd105Tags::CLIENT_CONTACT,
Ffd105Tags::CLIENT_PHONE_EMAIL,
Ffd105Tags::PAGENT_PHONE,
Ffd105Tags::RPO_PHONES,
Ffd105Tags::MTO_PHONES,

View File

@ -21,5 +21,5 @@ class TooLongClientContactException extends TooLongException
{
protected $message = 'Cлишком длинный телефон или email покупателя';
protected float $max = Constraints::MAX_LENGTH_CLIENT_CONTACT;
protected array $ffd_tags = [Ffd105Tags::CLIENT_CONTACT];
protected array $ffd_tags = [Ffd105Tags::CLIENT_PHONE_EMAIL];
}

View File

@ -22,7 +22,7 @@ class TooLongEmailException extends TooLongException
protected $message = 'Слишком длинный email';
protected float $max = Constraints::MAX_LENGTH_EMAIL;
protected array $ffd_tags = [
Ffd105Tags::CLIENT_CONTACT,
Ffd105Tags::CLIENT_PHONE_EMAIL,
Ffd105Tags::COMPANY_EMAIL,
];
}

View File

@ -17,8 +17,7 @@ use AtolOnline\{
Exceptions\TooLongClientNameException,
Exceptions\TooLongEmailException,
Helpers,
Tests\BasicTestCase
};
Tests\BasicTestCase};
/**
* Набор тестов для проверки работы класса покупателя
@ -111,8 +110,6 @@ class ClientTest extends BasicTestCase
(new Client())->setName(Helpers::randomStr(400));
}
//------------------------------------------------------------------------------------------------------------------
/**
* Тестирует установку телефонов, которые приводятся к null
*
@ -158,8 +155,6 @@ class ClientTest extends BasicTestCase
(new Client())->setPhone('99999999999999999999999999999999999999999999999999999999999999999999999999');
}
//------------------------------------------------------------------------------------------------------------------
/**
* Тестирует установку валидных email-ов
*
@ -208,8 +203,6 @@ class ClientTest extends BasicTestCase
(new Client())->setEmail($email);
}
//------------------------------------------------------------------------------------------------------------------
/**
* Тестирует исключение о корректной длине ИНН
*

View File

@ -67,16 +67,17 @@ class PayingAgentTest extends BasicTestCase
/**
* Тестирует установку операций, которые приводятся к null
*
* @param mixed $name
* @param mixed $operation
* @dataProvider providerNullableStrings
* @covers \AtolOnline\Entities\PayingAgent
* @covers \AtolOnline\Entities\PayingAgent::setOperation
* @covers \AtolOnline\Entities\PayingAgent::getOperation
* @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());
}
/**