mirror of
https://git.yoomoney.ru/scm/sdk/yookassa-sdk-php.git
synced 2026-09-14 11:56:14 +00:00
cbcdbc8ae1
Отказ от поддержки PHP < 8 Изменена структура файлов Переработана логика работы с моделями Добавлено использование валидатора данных в моделях Массивы объектов заменены на объекты-коллекции
52 lines
1.3 KiB
PHP
52 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace Tests\YooKassa\Request\Receipts;
|
|
|
|
use YooKassa\Validator\Exceptions\InvalidPropertyValueException;
|
|
use YooKassa\Helpers\Random;
|
|
use YooKassa\Request\Receipts\RefundReceiptResponse;
|
|
|
|
/**
|
|
* @internal
|
|
*/
|
|
class RefundReceiptResponseTest extends AbstractTestReceiptResponse
|
|
{
|
|
protected string $type = 'refund';
|
|
|
|
/**
|
|
* @dataProvider validDataProvider
|
|
*/
|
|
public function testSpecificProperties(array $options): void
|
|
{
|
|
$instance = $this->getTestInstance($options);
|
|
self::assertEquals($options['refund_id'], $instance->getRefundId());
|
|
}
|
|
|
|
/**
|
|
* @dataProvider invalidDataProvider
|
|
*/
|
|
public function testInvalidSpecificProperties(array $options): void
|
|
{
|
|
$this->expectException(InvalidPropertyValueException::class);
|
|
$this->getTestInstance($options);
|
|
}
|
|
|
|
protected function getTestInstance($options): RefundReceiptResponse
|
|
{
|
|
return new RefundReceiptResponse($options);
|
|
}
|
|
|
|
protected function addSpecificProperties($options, $i): array
|
|
{
|
|
$array = [
|
|
Random::str(30),
|
|
Random::str(40),
|
|
];
|
|
$options['refund_id'] = !$this->valid
|
|
? (Random::value($array))
|
|
: Random::value([null, '', Random::str(RefundReceiptResponse::LENGTH_REFUND_ID)]);
|
|
|
|
return $options;
|
|
}
|
|
}
|