expectException(TooManyPaymentsException::class); new Payments($this->generatePaymentObjects(Constraints::MAX_COUNT_DOC_PAYMENTS + 1)); } /** * Тестирует выброс исключения при добавлении лишней ставки в начало коллекции * * @covers \AtolOnline\Collections\EntityCollection::prepend * @covers \AtolOnline\Collections\EntityCollection::checkCount * @covers \AtolOnline\Exceptions\TooManyPaymentsException * @throws InvalidEnumValueException * @throws NegativePaymentSumException * @throws TooHighPaymentSumException * @throws InvalidEntityInCollectionException */ public function testTooManyPaymentsExceptionByPrepend() { $this->expectException(TooManyPaymentsException::class); (new Payments($this->generatePaymentObjects(Constraints::MAX_COUNT_DOC_PAYMENTS))) ->prepend($this->generatePaymentObjects()); } /** * Тестирует выброс исключения при добавлении лишней ставки в конец коллекции * * @covers \AtolOnline\Collections\EntityCollection * @covers \AtolOnline\Collections\EntityCollection::add * @covers \AtolOnline\Collections\EntityCollection::checkCount * @covers \AtolOnline\Exceptions\TooManyPaymentsException * @throws InvalidEnumValueException * @throws NegativePaymentSumException * @throws TooHighPaymentSumException * @throws InvalidEntityInCollectionException */ public function testTooManyPaymentsExceptionByAdd() { $this->expectException(TooManyPaymentsException::class); (new Payments($this->generatePaymentObjects(Constraints::MAX_COUNT_DOC_PAYMENTS))) ->add($this->generatePaymentObjects()); } /** * Тестирует выброс исключения при добавлении лишних оплат в конец коллекции * * @covers \AtolOnline\Collections\EntityCollection * @covers \AtolOnline\Collections\EntityCollection::push * @covers \AtolOnline\Collections\EntityCollection::checkCount * @covers \AtolOnline\Exceptions\TooManyPaymentsException * @throws InvalidEnumValueException * @throws NegativePaymentSumException * @throws TooHighPaymentSumException * @throws InvalidEntityInCollectionException */ public function testTooManyPaymentsExceptionByPush() { $this->expectException(TooManyPaymentsException::class); (new Payments($this->generatePaymentObjects(Constraints::MAX_COUNT_DOC_PAYMENTS + 1))) ->push(...$this->generatePaymentObjects()); } /** * Тестирует выброс исключения при добавлении лишней ставки в начало коллекции * * @covers \AtolOnline\Collections\EntityCollection * @covers \AtolOnline\Collections\EntityCollection::merge * @covers \AtolOnline\Collections\EntityCollection::checkCount * @covers \AtolOnline\Exceptions\TooManyPaymentsException * @throws InvalidEnumValueException * @throws NegativePaymentSumException * @throws TooHighPaymentSumException * @throws InvalidEntityInCollectionException */ public function testTooManyPaymentsExceptionByMerge() { $this->expectException(TooManyPaymentsException::class); (new Payments($this->generatePaymentObjects(Constraints::MAX_COUNT_DOC_PAYMENTS - 1))) ->merge($this->generatePaymentObjects(2)); } }