mirror of
https://github.com/retailcrm/NelmioApiDocBundle.git
synced 2025-02-02 15:51:48 +03:00
Merge PR #235
This commit is contained in:
commit
46275a51be
@ -140,6 +140,15 @@ class ValidationParser implements ParserInterface, PostParserInterface
|
||||
case 'Ip':
|
||||
$vparams['format'][] = '{ip address}';
|
||||
break;
|
||||
case 'Date':
|
||||
$vparams['format'][] = '{Date YYYY-MM-DD}';
|
||||
break;
|
||||
case 'DateTime':
|
||||
$vparams['format'][] = '{DateTime YYYY-MM-DD HH:MM:SS}';
|
||||
break;
|
||||
case 'Time':
|
||||
$vparams['format'][] = '{Time HH:MM:SS}';
|
||||
break;
|
||||
case 'Length':
|
||||
$messages = array();
|
||||
if (isset($constraint->min)) {
|
||||
|
@ -40,6 +40,21 @@ class ValidatorTest
|
||||
*/
|
||||
public $type;
|
||||
|
||||
/**
|
||||
* @Assert\Date();
|
||||
*/
|
||||
public $date;
|
||||
|
||||
/**
|
||||
* @Assert\DateTime();
|
||||
*/
|
||||
public $dateTime;
|
||||
|
||||
/**
|
||||
* @Assert\Time();
|
||||
*/
|
||||
public $time;
|
||||
|
||||
/**
|
||||
* @Assert\Email()
|
||||
*/
|
||||
|
@ -24,7 +24,9 @@ class ValidationParserTest extends WebTestCase
|
||||
$result = $this->parser->parse(array('class' => 'Nelmio\ApiDocBundle\Tests\Fixtures\Model\ValidatorTest'));
|
||||
|
||||
foreach ($expected as $name => $value) {
|
||||
$this->assertEquals($value, $expected[$name]);
|
||||
$this->assertArrayHasKey($property, $result);
|
||||
$this->assertArrayHasKey($name, $result[$property]);
|
||||
$this->assertEquals($result[$property][$name], $expected[$name]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -61,6 +63,24 @@ class ValidationParserTest extends WebTestCase
|
||||
'dataType' => 'DateTime'
|
||||
)
|
||||
),
|
||||
array(
|
||||
'property' => 'date',
|
||||
'expected' => array(
|
||||
'format' => '{Date YYYY-MM-DD}'
|
||||
)
|
||||
),
|
||||
array(
|
||||
'property' => 'dateTime',
|
||||
'expected' => array(
|
||||
'format' => '{DateTime YYYY-MM-DD HH:MM:SS}'
|
||||
)
|
||||
),
|
||||
array(
|
||||
'property' => 'time',
|
||||
'expected' => array(
|
||||
'format' => '{Time HH:MM:SS}'
|
||||
)
|
||||
),
|
||||
array(
|
||||
'property' => 'email',
|
||||
'expected' => array(
|
||||
|
Loading…
x
Reference in New Issue
Block a user