NelmioApiDocBundle/Tests/Functional/JMSFunctionalTest.php
Myroslav 01f691c456 support swagger property annotation to extend description properties of model (#1125)
* support swagger property annotation to descripe properties of model

* support swagger property annotation to descripe properties of model

* fix issues from PR review

* rename method

* remove redundant annotations and revert changes into composer.json

* fix issues from PR comments

* use symfony 3 for default tests

* revert chages

* use symfony 3 for default tests

* revert changes in travis config
2017-12-03 19:30:44 +01:00

57 lines
1.5 KiB
PHP

<?php
/*
* This file is part of the NelmioApiDocBundle package.
*
* (c) Nelmio
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Nelmio\ApiDocBundle\Tests\Functional;
class JMSFunctionalTest extends WebTestCase
{
public function testModelDocumentation()
{
$this->assertEquals([
'type' => 'object',
'properties' => [
'id' => [
'type' => 'integer',
'description' => "User id",
'readOnly' => true,
'title' => "userid",
'example' => 1,
],
'email' => [
'type' => 'string',
'readOnly' => false,
],
'roles' => [
'type' => 'array',
'items' => ['type' => 'string'],
],
'friendsNumber' => [
'type' => 'string',
],
'friends' => [
'type' => 'array',
'items' => [
'$ref' => '#/definitions/User',
],
],
'best_friend' => [
'$ref' => '#/definitions/User',
],
],
], $this->getModel('JMSUser')->toArray());
}
protected static function createKernel(array $options = array())
{
return new TestKernel(true);
}
}