mirror of
https://git.yoomoney.ru/scm/sdk/yookassa-sdk-php.git
synced 2026-10-19 06:07:05 +00:00
Обновленная версия SDK
This commit is contained in:
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use YooKassa\Helpers\Random;
|
||||
use YooKassa\Model\NotificationEventType;
|
||||
use YooKassa\Model\Webhook\Webhook;
|
||||
|
||||
class WebhookTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @dataProvider validDataProvider
|
||||
*
|
||||
* @param $data
|
||||
*/
|
||||
public function testWebhookInstantiate($data)
|
||||
{
|
||||
$webhook = new Webhook();
|
||||
|
||||
$webhook->setId($data['id']);
|
||||
$webhook->setUrl($data['url']);
|
||||
$webhook->setEvent($data['event']);
|
||||
|
||||
self::assertEquals($webhook->getId(), $data['id']);
|
||||
self::assertEquals($webhook->getUrl(), $data['url']);
|
||||
self::assertEquals($webhook->getEvent(), $data['event']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider validDataProvider
|
||||
*
|
||||
* @param $data
|
||||
*/
|
||||
public function testWebhookConstructorInstantiate($data)
|
||||
{
|
||||
$webhook = new Webhook($data);
|
||||
|
||||
self::assertEquals($webhook->getId(), $data['id']);
|
||||
self::assertEquals($webhook->getUrl(), $data['url']);
|
||||
self::assertEquals($webhook->getEvent(), $data['event']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function validDataProvider()
|
||||
{
|
||||
return array(
|
||||
array(
|
||||
array(
|
||||
"id" => Random::str(20),
|
||||
"event" => NotificationEventType::REFUND_SUCCEEDED,
|
||||
"url" => Random::str(20),
|
||||
),
|
||||
),
|
||||
array(
|
||||
array(
|
||||
"id" => Random::str(20),
|
||||
"event" => NotificationEventType::PAYMENT_SUCCEEDED,
|
||||
"url" => Random::str(20),
|
||||
),
|
||||
),
|
||||
array(
|
||||
array(
|
||||
"id" => Random::str(20),
|
||||
"event" => NotificationEventType::PAYMENT_WAITING_FOR_CAPTURE,
|
||||
"url" => Random::str(20),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user