mirror of
https://git.yoomoney.ru/scm/sdk/yookassa-sdk-php.git
synced 2026-10-17 21:26:41 +00:00
Обновленная версия SDK
This commit is contained in:
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\YooKassa\Model\Confirmation;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use YooKassa\Helpers\Random;
|
||||
use YooKassa\Model\Confirmation\AbstractConfirmation;
|
||||
|
||||
abstract class AbstractConfirmationTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @return AbstractConfirmation
|
||||
*/
|
||||
abstract protected function getTestInstance();
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
abstract protected function getExpectedType();
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public function testGetType()
|
||||
{
|
||||
$instance = $this->getTestInstance();
|
||||
self::assertEquals($this->getExpectedType(), $instance->getType());
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider invalidTypeDataProvider
|
||||
* @expectedException \InvalidArgumentException
|
||||
* @param $value
|
||||
*/
|
||||
public function testInvalidType($value)
|
||||
{
|
||||
new TestConfirmation($value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function invalidTypeDataProvider()
|
||||
{
|
||||
return array(
|
||||
array(''),
|
||||
array(null),
|
||||
array(Random::str(40)),
|
||||
array(0),
|
||||
array(array()),
|
||||
array(new \stdClass()),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class TestConfirmation extends AbstractConfirmation
|
||||
{
|
||||
public function __construct($type)
|
||||
{
|
||||
$this->_setType($type);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user