2023-10-01 20:23:30 +03:00
|
|
|
<?php
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
namespace RssBridge\Tests;
|
|
|
|
|
|
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
|
|
|
|
class ParameterValidatorTest extends TestCase
|
|
|
|
{
|
|
|
|
public function test1()
|
|
|
|
{
|
|
|
|
$sut = new \ParameterValidator();
|
|
|
|
$input = ['user' => 'joe'];
|
|
|
|
$parameters = [
|
|
|
|
[
|
|
|
|
'user' => [
|
|
|
|
'name' => 'User',
|
|
|
|
'type' => 'text',
|
|
|
|
],
|
|
|
|
]
|
|
|
|
];
|
2024-01-25 15:03:00 +03:00
|
|
|
$this->assertSame([], $sut->validateInput($input, $parameters));
|
2023-10-01 20:23:30 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
public function test2()
|
|
|
|
{
|
|
|
|
$sut = new \ParameterValidator();
|
|
|
|
$input = ['username' => 'joe'];
|
|
|
|
$parameters = [
|
|
|
|
[
|
|
|
|
'user' => [
|
|
|
|
'name' => 'User',
|
|
|
|
'type' => 'text',
|
|
|
|
],
|
|
|
|
]
|
|
|
|
];
|
2024-01-25 15:03:00 +03:00
|
|
|
$this->assertNotEmpty($sut->validateInput($input, $parameters));
|
2023-10-01 20:23:30 +03:00
|
|
|
}
|
|
|
|
}
|