Доработка коллекций и не только

- коллекция `Items` с покрытием
- вынос коллекций из `AtolOnline\Entities` в `AtolOnline\Collections`
- фикс ] в `AtolException`
- финализирован `CorrectionInfo`
- фиксы по тестам коллекций
- прочие мелочи по phpdoc
This commit is contained in:
2021-12-06 16:14:19 +08:00
parent bf09641c8b
commit 557c76fefa
25 changed files with 441 additions and 120 deletions

View File

@@ -23,6 +23,7 @@ use AtolOnline\Exceptions\TooLongPasswordException;
use AtolOnline\Helpers;
use AtolOnline\TestEnvParams;
use AtolOnline\Tests\BasicTestCase;
use Exception;
use GuzzleHttp\Exception\GuzzleException;
/**
@@ -327,6 +328,7 @@ class KktMonitorTest extends BasicTestCase
* @throws TooLongPasswordException
* @throws EmptyMonitorDataException
* @throws NotEnoughMonitorDataException
* @throws Exception
*/
public function testMonitorGetOne(): void
{

View File

@@ -11,8 +11,10 @@ declare(strict_types = 1);
namespace AtolOnline\Tests;
use AtolOnline\Collections\EntityCollection;
use AtolOnline\Entities\Entity;
use AtolOnline\Helpers;
use Exception;
use GuzzleHttp\Client;
use GuzzleHttp\Exception\GuzzleException;
use Illuminate\Support\Collection;
@@ -66,12 +68,14 @@ class BasicTestCase extends TestCase
/**
* Тестирует является ли объект приводимым к json-строке согласно схеме АТОЛ Онлайн
*
* @param Entity $entity
* @param Entity|EntityCollection $entity
* @param array|null $json_structure
* @covers \AtolOnline\Entities\Entity::jsonSerialize
* @covers \AtolOnline\Entities\Entity::__toString
* @covers \AtolOnline\Entities\Entity::jsonSerialize
* @covers \AtolOnline\Collections\EntityCollection::jsonSerialize
* @throws Exception
*/
public function assertAtolable(Entity $entity, ?array $json_structure = null): void
public function assertAtolable(Entity|EntityCollection $entity, ?array $json_structure = null): void
{
$this->assertIsArray($entity->jsonSerialize());
$this->assertIsString((string)$entity);
@@ -204,7 +208,7 @@ class BasicTestCase extends TestCase
/**
* Провайдер строк, которые приводятся к null
*
* @return array<array<string|null>>
* @return array
*/
public function providerNullableStrings(): array
{

View File

@@ -0,0 +1,156 @@
<?php
/*
* Copyright (c) 2020-2021 Антон Аксенов (Anthony Axenov)
*
* This code is licensed under MIT.
* Этот код распространяется по лицензии MIT.
* https://github.com/anthonyaxenov/atol-online/blob/master/LICENSE
*/
namespace AtolOnline\Tests\Collections;
use AtolOnline\{
Collections\Items,
Constants\Constraints,
Entities\Item,
Helpers,
Tests\BasicTestCase};
use AtolOnline\Exceptions\{
EmptyItemNameException,
NegativeItemPriceException,
NegativeItemQuantityException,
TooHighItemPriceException,
TooLongItemNameException,
TooManyException,
TooManyItemsException,};
use Exception;
/**
* Набор тестов для проверки работы класса коллекции предметов расчёта
*/
class ItemsTest extends BasicTestCase
{
/**
* Тестирует выброс исключения при установке слишком большого количества оплат через конструктор
*
* @covers \AtolOnline\Collections\EntityCollection
* @covers \AtolOnline\Collections\EntityCollection::checkCount
* @covers \AtolOnline\Exceptions\TooManyItemsException
* @throws EmptyItemNameException
* @throws NegativeItemPriceException
* @throws NegativeItemQuantityException
* @throws TooHighItemPriceException
* @throws TooLongItemNameException
* @throws TooManyException
*/
public function testTooManyItemsExceptionByConstructor()
{
$this->expectException(TooManyItemsException::class);
new Items($this->generateObjects(Constraints::MAX_COUNT_DOC_ITEMS + 1));
}
/**
* Тестирует выброс исключения при добавлении лишней ставки в начало коллекции
*
* @covers \AtolOnline\Collections\EntityCollection::prepend
* @covers \AtolOnline\Collections\EntityCollection::checkCount
* @covers \AtolOnline\Exceptions\TooManyItemsException
* @throws EmptyItemNameException
* @throws NegativeItemPriceException
* @throws NegativeItemQuantityException
* @throws TooHighItemPriceException
* @throws TooLongItemNameException
* @throws TooManyException
*/
public function testTooManyItemsExceptionByPrepend()
{
$this->expectException(TooManyItemsException::class);
(new Items($this->generateObjects(Constraints::MAX_COUNT_DOC_ITEMS)))
->prepend($this->generateObjects());
}
/**
* Тестирует выброс исключения при добавлении лишней ставки в конец коллекции
*
* @covers \AtolOnline\Collections\EntityCollection
* @covers \AtolOnline\Collections\EntityCollection::add
* @covers \AtolOnline\Collections\EntityCollection::checkCount
* @covers \AtolOnline\Exceptions\TooManyItemsException
* @throws EmptyItemNameException
* @throws NegativeItemPriceException
* @throws NegativeItemQuantityException
* @throws TooHighItemPriceException
* @throws TooLongItemNameException
* @throws TooManyException
*/
public function testTooManyItemsExceptionByAdd()
{
$this->expectException(TooManyItemsException::class);
(new Items($this->generateObjects(Constraints::MAX_COUNT_DOC_ITEMS)))
->add($this->generateObjects());
}
/**
* Тестирует выброс исключения при добавлении лишних оплат в конец коллекции
*
* @covers \AtolOnline\Collections\EntityCollection
* @covers \AtolOnline\Collections\EntityCollection::push
* @covers \AtolOnline\Collections\EntityCollection::checkCount
* @covers \AtolOnline\Exceptions\TooManyItemsException
* @throws EmptyItemNameException
* @throws NegativeItemPriceException
* @throws NegativeItemQuantityException
* @throws TooHighItemPriceException
* @throws TooLongItemNameException
* @throws TooManyException
*/
public function testTooManyItemsExceptionByPush()
{
$this->expectException(TooManyItemsException::class);
(new Items($this->generateObjects(Constraints::MAX_COUNT_DOC_ITEMS)))
->push(...$this->generateObjects());
}
/**
* Тестирует выброс исключения при добавлении лишней ставки в начало коллекции
*
* @covers \AtolOnline\Collections\EntityCollection
* @covers \AtolOnline\Collections\EntityCollection::merge
* @covers \AtolOnline\Collections\EntityCollection::checkCount
* @covers \AtolOnline\Exceptions\TooManyItemsException
* @throws EmptyItemNameException
* @throws NegativeItemPriceException
* @throws NegativeItemQuantityException
* @throws TooHighItemPriceException
* @throws TooLongItemNameException
* @throws TooManyException
*/
public function testTooManyItemsExceptionByMerge()
{
$this->expectException(TooManyItemsException::class);
(new Items($this->generateObjects(Constraints::MAX_COUNT_DOC_ITEMS)))
->merge($this->generateObjects(2));
}
/**
* Генерирует массив тестовых объектов предметов расчёта
*
* @param int $count
* @return Item[]
* @throws EmptyItemNameException
* @throws NegativeItemPriceException
* @throws NegativeItemQuantityException
* @throws TooHighItemPriceException
* @throws TooLongItemNameException
* @throws TooManyException
* @throws Exception
*/
protected function generateObjects(int $count = 1): array
{
$result = [];
for ($i = 0; $i < abs($count); ++$i) {
$result[] = new Item(Helpers::randomStr(), random_int(1, 100), random_int(1, 10));
}
return $result;
}
}

View File

@@ -7,12 +7,12 @@
* https://github.com/anthonyaxenov/atol-online/blob/master/LICENSE
*/
namespace AtolOnline\Tests\Entities;
namespace AtolOnline\Tests\Collections;
use AtolOnline\{
Collections\Payments,
Constants\Constraints,
Entities\Payment,
Entities\Payments,
Enums\PaymentTypes,
Exceptions\InvalidEnumValueException,
Exceptions\NegativePaymentSumException,
@@ -29,8 +29,8 @@ class PaymentsTest extends BasicTestCase
/**
* Тестирует выброс исключения при установке слишком большого количества оплат через конструктор
*
* @covers \AtolOnline\Entities\EntityCollection
* @covers \AtolOnline\Entities\EntityCollection::checkCount
* @covers \AtolOnline\Collections\EntityCollection
* @covers \AtolOnline\Collections\EntityCollection::checkCount
* @covers \AtolOnline\Exceptions\TooManyPaymentsException
* @throws InvalidEnumValueException
* @throws NegativePaymentSumException
@@ -45,8 +45,8 @@ class PaymentsTest extends BasicTestCase
/**
* Тестирует выброс исключения при добавлении лишней ставки в начало коллекции
*
* @covers \AtolOnline\Entities\EntityCollection::prepend
* @covers \AtolOnline\Entities\EntityCollection::checkCount
* @covers \AtolOnline\Collections\EntityCollection::prepend
* @covers \AtolOnline\Collections\EntityCollection::checkCount
* @covers \AtolOnline\Exceptions\TooManyPaymentsException
* @throws InvalidEnumValueException
* @throws NegativePaymentSumException
@@ -55,16 +55,16 @@ class PaymentsTest extends BasicTestCase
public function testTooManyPaymentsExceptionByPrepend()
{
$this->expectException(TooManyPaymentsException::class);
(new Payments($this->generateObjects(10)))
(new Payments($this->generateObjects(Constraints::MAX_COUNT_DOC_PAYMENTS)))
->prepend($this->generateObjects());
}
/**
* Тестирует выброс исключения при добавлении лишней ставки в конец коллекции
*
* @covers \AtolOnline\Entities\Payments
* @covers \AtolOnline\Entities\Payments::add
* @covers \AtolOnline\Entities\EntityCollection::checkCount
* @covers \AtolOnline\Collections\EntityCollection
* @covers \AtolOnline\Collections\EntityCollection::add
* @covers \AtolOnline\Collections\EntityCollection::checkCount
* @covers \AtolOnline\Exceptions\TooManyPaymentsException
* @throws InvalidEnumValueException
* @throws NegativePaymentSumException
@@ -73,16 +73,16 @@ class PaymentsTest extends BasicTestCase
public function testTooManyPaymentsExceptionByAdd()
{
$this->expectException(TooManyPaymentsException::class);
(new Payments($this->generateObjects(10)))
(new Payments($this->generateObjects(Constraints::MAX_COUNT_DOC_PAYMENTS)))
->add($this->generateObjects());
}
/**
* Тестирует выброс исключения при добавлении лишних оплат в конец коллекции
*
* @covers \AtolOnline\Entities\EntityCollection
* @covers \AtolOnline\Entities\EntityCollection::push
* @covers \AtolOnline\Entities\EntityCollection::checkCount
* @covers \AtolOnline\Collections\EntityCollection
* @covers \AtolOnline\Collections\EntityCollection::push
* @covers \AtolOnline\Collections\EntityCollection::checkCount
* @covers \AtolOnline\Exceptions\TooManyPaymentsException
* @throws InvalidEnumValueException
* @throws NegativePaymentSumException
@@ -91,16 +91,16 @@ class PaymentsTest extends BasicTestCase
public function testTooManyPaymentsExceptionByPush()
{
$this->expectException(TooManyPaymentsException::class);
(new Payments($this->generateObjects(10)))
(new Payments($this->generateObjects(Constraints::MAX_COUNT_DOC_PAYMENTS + 1)))
->push(...$this->generateObjects());
}
/**
* Тестирует выброс исключения при добавлении лишней ставки в начало коллекции
*
* @covers \AtolOnline\Entities\EntityCollection
* @covers \AtolOnline\Entities\EntityCollection::merge
* @covers \AtolOnline\Entities\EntityCollection::checkCount
* @covers \AtolOnline\Collections\EntityCollection
* @covers \AtolOnline\Collections\EntityCollection::merge
* @covers \AtolOnline\Collections\EntityCollection::checkCount
* @covers \AtolOnline\Exceptions\TooManyPaymentsException
* @throws InvalidEnumValueException
* @throws NegativePaymentSumException
@@ -109,13 +109,15 @@ class PaymentsTest extends BasicTestCase
public function testTooManyPaymentsExceptionByMerge()
{
$this->expectException(TooManyPaymentsException::class);
(new Payments($this->generateObjects(9)))
(new Payments($this->generateObjects(Constraints::MAX_COUNT_DOC_PAYMENTS - 1)))
->merge($this->generateObjects(2));
}
/**
* Генерирует массив тестовых объектов оплаты
*
* @param int $count
* @return Payment[]
* @throws InvalidEnumValueException
* @throws NegativePaymentSumException
* @throws TooHighPaymentSumException

View File

@@ -7,14 +7,19 @@
* https://github.com/anthonyaxenov/atol-online/blob/master/LICENSE
*/
namespace AtolOnline\Tests\Entities;
namespace AtolOnline\Tests\Collections;
use AtolOnline\{
Collections\Vats,
Constants\Constraints,
Entities\Payment,
Entities\Vat,
Entities\Vats,
Enums\PaymentTypes,
Enums\VatTypes,
Exceptions\InvalidEntityInCollectionException,
Exceptions\InvalidEnumValueException,
Exceptions\NegativePaymentSumException,
Exceptions\TooHighPaymentSumException,
Exceptions\TooManyVatsException,
Tests\BasicTestCase};
use Exception;
@@ -27,22 +32,24 @@ class VatsTest extends BasicTestCase
/**
* Тестирует создание коллекции ставок
*
* @covers \AtolOnline\Entities\EntityCollection
* @covers \AtolOnline\Entities\EntityCollection::checkCount
* @covers \AtolOnline\Collections\EntityCollection
* @covers \AtolOnline\Collections\EntityCollection::checkCount
* @throws InvalidEnumValueException
* @throws Exception
*/
public function testConstructor()
{
$vats = new Vats($this->generateObjects(3));
$this->assertIsCollection($vats);
$this->assertEquals(3, $vats->count());
$this->assertAtolable($vats);
}
/**
* Тестирует выброс исключения при установке слишком большого количества ставок через конструктор
*
* @covers \AtolOnline\Entities\EntityCollection
* @covers \AtolOnline\Entities\EntityCollection::checkCount
* @covers \AtolOnline\Collections\EntityCollection
* @covers \AtolOnline\Collections\EntityCollection::checkCount
* @covers \AtolOnline\Exceptions\TooManyVatsException
* @throws InvalidEnumValueException
*/
@@ -55,9 +62,9 @@ class VatsTest extends BasicTestCase
/**
* Тестирует добавление ставки в начало коллекции
*
* @covers \AtolOnline\Entities\EntityCollection
* @covers \AtolOnline\Entities\EntityCollection::prepend
* @covers \AtolOnline\Entities\EntityCollection::checkCount
* @covers \AtolOnline\Collections\EntityCollection
* @covers \AtolOnline\Collections\EntityCollection::prepend
* @covers \AtolOnline\Collections\EntityCollection::checkCount
* @throws InvalidEnumValueException
*/
public function testPrepend()
@@ -70,25 +77,25 @@ class VatsTest extends BasicTestCase
/**
* Тестирует выброс исключения при добавлении лишней ставки в начало коллекции
*
* @covers \AtolOnline\Entities\EntityCollection
* @covers \AtolOnline\Entities\EntityCollection::prepend
* @covers \AtolOnline\Entities\EntityCollection::checkCount
* @covers \AtolOnline\Collections\EntityCollection
* @covers \AtolOnline\Collections\EntityCollection::prepend
* @covers \AtolOnline\Collections\EntityCollection::checkCount
* @covers \AtolOnline\Exceptions\TooManyVatsException
* @throws InvalidEnumValueException
*/
public function testTooManyVatsExceptionByPrepend()
{
$this->expectException(TooManyVatsException::class);
(new Vats($this->generateObjects(Constraints::MAX_COUNT_DOC_VATS + 1)))
(new Vats($this->generateObjects(Constraints::MAX_COUNT_DOC_VATS)))
->prepend($this->generateObjects());
}
/**
* Тестирует добавление ставки в конец коллекции
*
* @covers \AtolOnline\Entities\EntityCollection
* @covers \AtolOnline\Entities\EntityCollection::add
* @covers \AtolOnline\Entities\EntityCollection::checkCount
* @covers \AtolOnline\Collections\EntityCollection
* @covers \AtolOnline\Collections\EntityCollection::add
* @covers \AtolOnline\Collections\EntityCollection::checkCount
* @throws InvalidEnumValueException
*/
public function testAdd()
@@ -101,25 +108,25 @@ class VatsTest extends BasicTestCase
/**
* Тестирует выброс исключения при добавлении лишней ставки в конец коллекции
*
* @covers \AtolOnline\Entities\EntityCollection
* @covers \AtolOnline\Entities\EntityCollection::add
* @covers \AtolOnline\Entities\EntityCollection::checkCount
* @covers \AtolOnline\Collections\EntityCollection
* @covers \AtolOnline\Collections\EntityCollection::add
* @covers \AtolOnline\Collections\EntityCollection::checkCount
* @covers \AtolOnline\Exceptions\TooManyVatsException
* @throws InvalidEnumValueException
*/
public function testTooManyVatsExceptionByAdd()
{
$this->expectException(TooManyVatsException::class);
(new Vats($this->generateObjects(Constraints::MAX_COUNT_DOC_VATS + 1)))
(new Vats($this->generateObjects(Constraints::MAX_COUNT_DOC_VATS)))
->add($this->generateObjects());
}
/**
* Тестирует добавление лишних ставок в конец коллекции
*
* @covers \AtolOnline\Entities\EntityCollection
* @covers \AtolOnline\Entities\EntityCollection::push
* @covers \AtolOnline\Entities\EntityCollection::checkCount
* @covers \AtolOnline\Collections\EntityCollection
* @covers \AtolOnline\Collections\EntityCollection::push
* @covers \AtolOnline\Collections\EntityCollection::checkCount
* @throws InvalidEnumValueException
*/
public function testPush()
@@ -132,25 +139,25 @@ class VatsTest extends BasicTestCase
/**
* Тестирует выброс исключения при добавлении лишних ставок в конец коллекции
*
* @covers \AtolOnline\Entities\EntityCollection
* @covers \AtolOnline\Entities\EntityCollection::push
* @covers \AtolOnline\Entities\EntityCollection::checkCount
* @covers \AtolOnline\Collections\EntityCollection
* @covers \AtolOnline\Collections\EntityCollection::push
* @covers \AtolOnline\Collections\EntityCollection::checkCount
* @covers \AtolOnline\Exceptions\TooManyVatsException
* @throws InvalidEnumValueException
*/
public function testTooManyVatsExceptionByPush()
{
$this->expectException(TooManyVatsException::class);
(new Vats($this->generateObjects(Constraints::MAX_COUNT_DOC_VATS + 1)))
(new Vats($this->generateObjects(Constraints::MAX_COUNT_DOC_VATS)))
->push(...$this->generateObjects());
}
/**
* Тестирует добавление ставки в начало коллекции
*
* @covers \AtolOnline\Entities\EntityCollection
* @covers \AtolOnline\Entities\EntityCollection::merge
* @covers \AtolOnline\Entities\EntityCollection::checkCount
* @covers \AtolOnline\Collections\EntityCollection
* @covers \AtolOnline\Collections\EntityCollection::merge
* @covers \AtolOnline\Collections\EntityCollection::checkCount
* @throws InvalidEnumValueException
*/
public function testMerge()
@@ -163,22 +170,60 @@ class VatsTest extends BasicTestCase
/**
* Тестирует выброс исключения при добавлении лишней ставки в начало коллекции
*
* @covers \AtolOnline\Entities\EntityCollection
* @covers \AtolOnline\Entities\EntityCollection::merge
* @covers \AtolOnline\Entities\EntityCollection::checkCount
* @covers \AtolOnline\Collections\EntityCollection
* @covers \AtolOnline\Collections\EntityCollection::merge
* @covers \AtolOnline\Collections\EntityCollection::checkCount
* @covers \AtolOnline\Exceptions\TooManyVatsException
* @throws InvalidEnumValueException
*/
public function testTooManyVatsExceptionByMerge()
{
$this->expectException(TooManyVatsException::class);
(new Vats($this->generateObjects(9)))
(new Vats($this->generateObjects(Constraints::MAX_COUNT_DOC_VATS - 1)))
->merge($this->generateObjects(2));
}
/**
* Тестирует выброс исключения при наличии скаляров в коллекции
*
* @covers \AtolOnline\Collections\EntityCollection
* @covers \AtolOnline\Collections\EntityCollection::checkClass
* @covers \AtolOnline\Collections\EntityCollection::jsonSerialize
* @covers \AtolOnline\Exceptions\InvalidEntityInCollectionException
* @throws InvalidEnumValueException
* @throws Exception
*/
public function testInvalidCollectionItemExceptionScalar(): void
{
$this->expectException(InvalidEntityInCollectionException::class);
$this->expectExceptionMessage("(string)'bad element'");
(new Vats($this->generateObjects(2)))
->merge('bad element')
->jsonSerialize();
}
/**
* Тестирует выброс исключения при наличии объектов не тех классов в коллекции
*
* @throws InvalidEnumValueException
* @throws NegativePaymentSumException
* @throws TooHighPaymentSumException
* @throws Exception
*/
public function testInvalidCollectionItemExceptionObject(): void
{
$this->expectException(InvalidEntityInCollectionException::class);
$this->expectExceptionMessage(Payment::class);
(new Vats($this->generateObjects()))
->merge([new Payment(PaymentTypes::PREPAID, 1)])
->jsonSerialize();
}
/**
* Генерирует массив тестовых объектов ставок НДС
*
* @param int $count
* @return Vat[]
* @throws InvalidEnumValueException
* @throws Exception
*/

View File

@@ -19,8 +19,8 @@ use AtolOnline\{
Exceptions\InvalidInnLengthException,
Exceptions\InvalidPhoneException,
Exceptions\TooLongPayingAgentOperationException,
Tests\BasicTestCase
};
Tests\BasicTestCase};
use Exception;
/**
* Набор тестов для проверки работы класса агента
@@ -32,6 +32,7 @@ class AgentInfoTest extends BasicTestCase
*
* @covers \AtolOnline\Entities\AgentInfo
* @covers \AtolOnline\Entities\AgentInfo::jsonSerialize
* @throws Exception
*/
public function testConstructorWithoutArgs(): void
{
@@ -58,6 +59,7 @@ class AgentInfoTest extends BasicTestCase
* @throws TooLongPayingAgentOperationException
* @throws InvalidInnLengthException
* @throws InvalidEnumValueException
* @throws Exception
*/
public function testConstructorWithArgs(): void
{

View File

@@ -18,6 +18,7 @@ use AtolOnline\{
Exceptions\TooLongEmailException,
Helpers,
Tests\BasicTestCase};
use Exception;
/**
* Набор тестов для проверки работы класса покупателя
@@ -29,6 +30,7 @@ class ClientTest extends BasicTestCase
*
* @covers \AtolOnline\Entities\Client
* @covers \AtolOnline\Entities\Client::jsonSerialize
* @throws Exception
*/
public function testConstructorWithoutArgs(): void
{
@@ -48,6 +50,7 @@ class ClientTest extends BasicTestCase
* @covers \AtolOnline\Entities\Client::getPhone
* @covers \AtolOnline\Entities\Client::getEmail
* @covers \AtolOnline\Entities\Client::getInn
* @throws Exception
*/
public function testConstructorWithArgs(): void
{

View File

@@ -20,6 +20,7 @@ use AtolOnline\{
Exceptions\TooLongPaymentAddressException,
Helpers,
Tests\BasicTestCase};
use Exception;
/**
* Набор тестов для проверки работы класса продавца
@@ -39,6 +40,7 @@ class CompanyTest extends BasicTestCase
* @covers \AtolOnline\Entities\Company::getSno
* @covers \AtolOnline\Entities\Company::getInn
* @covers \AtolOnline\Entities\Company::getPaymentAddress
* @throws Exception
*/
public function testConstructor()
{
@@ -61,6 +63,12 @@ class CompanyTest extends BasicTestCase
* @covers \AtolOnline\Entities\Company
* @covers \AtolOnline\Entities\Company::setEmail
* @covers \AtolOnline\Exceptions\TooLongEmailException
* @throws InvalidEmailException
* @throws InvalidEnumValueException
* @throws InvalidInnLengthException
* @throws InvalidPaymentAddressException
* @throws TooLongEmailException
* @throws TooLongPaymentAddressException
*/
public function testEmailTooLongException()
{
@@ -100,6 +108,12 @@ class CompanyTest extends BasicTestCase
* @covers \AtolOnline\Entities\Company
* @covers \AtolOnline\Entities\Company::setInn
* @covers \AtolOnline\Exceptions\InvalidInnLengthException
* @throws InvalidEmailException
* @throws InvalidEnumValueException
* @throws InvalidInnLengthException
* @throws InvalidPaymentAddressException
* @throws TooLongEmailException
* @throws TooLongPaymentAddressException
*/
public function testInvalidInnLengthException()
{
@@ -113,6 +127,12 @@ class CompanyTest extends BasicTestCase
* @covers \AtolOnline\Entities\Company
* @covers \AtolOnline\Entities\Company::setPaymentAddress
* @covers \AtolOnline\Exceptions\TooLongPaymentAddressException
* @throws InvalidEmailException
* @throws InvalidEnumValueException
* @throws InvalidInnLengthException
* @throws InvalidPaymentAddressException
* @throws TooLongEmailException
* @throws TooLongPaymentAddressException
*/
public function testTooLongPaymentAddressException()
{

View File

@@ -16,8 +16,8 @@ use AtolOnline\{
Exceptions\InvalidCorrectionDateException,
Exceptions\InvalidEnumValueException,
Helpers,
Tests\BasicTestCase
};
Tests\BasicTestCase};
use Exception;
/**
* Набор тестов для проверки работы класса данных коррекции
@@ -39,6 +39,7 @@ class CorrectionInfoTest extends BasicTestCase
* @throws InvalidEnumValueException
* @throws InvalidCorrectionDateException
* @throws EmptyCorrectionNumberException
* @throws Exception
*/
public function testConstructor(): void
{

View File

@@ -41,8 +41,8 @@ use AtolOnline\{
Exceptions\TooLongUserdataException,
Exceptions\TooManyException,
Helpers,
Tests\BasicTestCase
};
Tests\BasicTestCase};
use Exception;
/**
* Набор тестов для проверки работы класс продавца
@@ -67,6 +67,7 @@ class ItemTest extends BasicTestCase
* @throws NegativeItemPriceException
* @throws EmptyItemNameException
* @throws NegativeItemQuantityException
* @throws Exception
*/
public function testConstructor(): void
{
@@ -263,6 +264,7 @@ class ItemTest extends BasicTestCase
* @throws TooHighItemPriceException
* @throws NegativeItemQuantityException
* @throws TooLongItemNameException
* @throws Exception
*/
public function testValidEnums(): void
{
@@ -332,11 +334,14 @@ class ItemTest extends BasicTestCase
* @covers \AtolOnline\Entities\Item::getVat
* @covers \AtolOnline\Entities\Item::jsonSerialize
* @throws EmptyItemNameException
* @throws InvalidEnumValueException
* @throws NegativeItemPriceException
* @throws NegativeItemQuantityException
* @throws TooHighItemPriceException
* @throws TooHighItemSumException
* @throws TooLongItemNameException
* @throws TooManyException
* @throws Exception
*/
public function testValidVatByString(): void
{
@@ -363,11 +368,14 @@ class ItemTest extends BasicTestCase
* @covers \AtolOnline\Entities\Item::getVat
* @covers \AtolOnline\Entities\Item::jsonSerialize
* @throws EmptyItemNameException
* @throws InvalidEnumValueException
* @throws NegativeItemPriceException
* @throws NegativeItemQuantityException
* @throws TooHighItemPriceException
* @throws TooHighItemSumException
* @throws TooLongItemNameException
* @throws TooManyException
* @throws Exception
*/
public function testValidVatByObject(): void
{
@@ -453,6 +461,7 @@ class ItemTest extends BasicTestCase
* @throws TooHighItemPriceException
* @throws TooLongItemNameException
* @throws TooManyException
* @throws Exception
*/
public function testSupplier(): void
{
@@ -489,6 +498,7 @@ class ItemTest extends BasicTestCase
* @throws TooLongItemNameException
* @throws TooLongUserdataException
* @throws TooManyException
* @throws Exception
*/
public function testValidUserdata(): void
{
@@ -558,6 +568,7 @@ class ItemTest extends BasicTestCase
* @throws TooHighItemPriceException
* @throws TooLongItemNameException
* @throws TooManyException
* @throws Exception
*/
public function testCountryCode(): void
{
@@ -605,6 +616,7 @@ class ItemTest extends BasicTestCase
* @throws TooLongItemNameException
* @throws TooManyException
* @throws InvalidDeclarationNumberException
* @throws Exception
*/
public function testValidDeclarationNumber(): void
{
@@ -675,6 +687,7 @@ class ItemTest extends BasicTestCase
* @throws EmptyItemNameException
* @throws NegativeItemQuantityException
* @throws NegativeItemExciseException
* @throws Exception
*/
public function testExcise(): void
{
@@ -723,6 +736,7 @@ class ItemTest extends BasicTestCase
* @throws TooLongItemNameException
* @throws TooManyException
* @throws TooLongItemCodeException
* @throws Exception
*/
public function testValidNomenclatureCode(): void
{

View File

@@ -14,6 +14,7 @@ use AtolOnline\{
Exceptions\InvalidInnLengthException,
Exceptions\InvalidPhoneException,
Tests\BasicTestCase};
use Exception;
/**
* Набор тестов для проверки работы класса оператора перевода
@@ -46,6 +47,7 @@ class MoneyTransferOperatorTest extends BasicTestCase
* @covers \AtolOnline\Entities\MoneyTransferOperator::getAddress
* @throws InvalidPhoneException
* @throws InvalidInnLengthException
* @throws Exception
*/
public function testConstructorWithArgs(): void
{

View File

@@ -15,6 +15,7 @@ use AtolOnline\{
Exceptions\TooLongPayingAgentOperationException,
Helpers,
Tests\BasicTestCase};
use Exception;
/**
* Набор тестов для проверки работы класса платёжного агента
@@ -43,6 +44,7 @@ class PayingAgentTest extends BasicTestCase
* @covers \AtolOnline\Entities\PayingAgent::getPhones
* @throws InvalidPhoneException
* @throws TooLongPayingAgentOperationException
* @throws Exception
*/
public function testConstructorWithArgs(): void
{

View File

@@ -13,13 +13,12 @@ use AtolOnline\{
Constants\Constraints,
Entities\Payment,
Enums\PaymentTypes,
Tests\BasicTestCase
};
Tests\BasicTestCase};
use AtolOnline\Exceptions\{
InvalidEnumValueException,
NegativePaymentSumException,
TooHighPaymentSumException,
};
TooHighPaymentSumException,};
use Exception;
/**
* Набор тестов для проверки работы класса оплаты
@@ -39,6 +38,7 @@ class PaymentTest extends BasicTestCase
* @throws InvalidEnumValueException
* @throws NegativePaymentSumException
* @throws TooHighPaymentSumException
* @throws Exception
*/
public function testConstructor(): void
{

View File

@@ -13,6 +13,7 @@ use AtolOnline\{
Entities\ReceivePaymentsOperator,
Exceptions\InvalidPhoneException,
Tests\BasicTestCase};
use Exception;
/**
* Набор тестов для проверки работы класса оператора по приёму платежей
@@ -38,6 +39,7 @@ class ReceivePaymentsOperatorTest extends BasicTestCase
* @covers \AtolOnline\Entities\ReceivePaymentsOperator::setPhones
* @covers \AtolOnline\Entities\ReceivePaymentsOperator::getPhones
* @throws InvalidPhoneException
* @throws Exception
*/
public function testConstructorWithArgs(): void
{

View File

@@ -14,6 +14,7 @@ use AtolOnline\{
Exceptions\InvalidInnLengthException,
Exceptions\InvalidPhoneException,
Tests\BasicTestCase};
use Exception;
/**
* Набор тестов для проверки работы класса поставщика
@@ -44,6 +45,7 @@ class SupplierTest extends BasicTestCase
* @covers \AtolOnline\Entities\Supplier::getInn
* @throws InvalidPhoneException
* @throws InvalidInnLengthException
* @throws Exception
*/
public function testConstructorWithArgs(): void
{

View File

@@ -14,6 +14,7 @@ use AtolOnline\{
Enums\VatTypes,
Exceptions\InvalidEnumValueException,
Tests\BasicTestCase};
use Exception;
/**
* Набор тестов для проверки работы класса ставки НДС
@@ -70,6 +71,7 @@ class VatTest extends BasicTestCase
* @covers \AtolOnline\Entities\Vat::getCalculated
* @covers \AtolOnline\Entities\Vat::jsonSerialize
* @throws InvalidEnumValueException
* @throws Exception
*/
public function testConstructor(string $type, float $sum): void
{