This commit is contained in:
William Durand 2015-10-22 14:42:59 +02:00
parent 3c47357a0e
commit ce71bf0629
No known key found for this signature in database
GPG Key ID: A509BCF1C1274F3B
7 changed files with 20 additions and 17 deletions

View File

@ -38,15 +38,15 @@ class CachingApiDocExtractor extends ApiDocExtractor
private $debug; private $debug;
/** /**
* @param ContainerInterface $container * @param ContainerInterface $container
* @param RouterInterface $router * @param RouterInterface $router
* @param Reader $reader * @param Reader $reader
* @param DocCommentExtractor $commentExtractor * @param DocCommentExtractor $commentExtractor
* @param ControllerNameParser $controllerNameParser * @param ControllerNameParser $controllerNameParser
* @param array $handlers * @param array $handlers
* @param array $annotationsProviders * @param array $annotationsProviders
* @param string $cacheFile * @param string $cacheFile
* @param bool|false $debug * @param bool|false $debug
*/ */
public function __construct( public function __construct(
ContainerInterface $container, ContainerInterface $container,
@ -66,7 +66,7 @@ class CachingApiDocExtractor extends ApiDocExtractor
} }
/** /**
* @param string $view View name * @param string $view View name
* @return array|mixed * @return array|mixed
*/ */
public function all($view = ApiDoc::DEFAULT_VIEW) public function all($view = ApiDoc::DEFAULT_VIEW)
@ -99,7 +99,7 @@ class CachingApiDocExtractor extends ApiDocExtractor
} }
/** /**
* @param string $view * @param string $view
* @return ConfigCache * @return ConfigCache
*/ */
private function getViewCache($view) private function getViewCache($view)

View File

@ -42,6 +42,7 @@ class JsonSerializableParser implements ParserInterface
if (isset($input['name']) && !empty($input['name'])) { if (isset($input['name']) && !empty($input['name'])) {
$output = array(); $output = array();
$output[$input['name']] = $parsed; $output[$input['name']] = $parsed;
return $output; return $output;
} }
@ -79,7 +80,7 @@ class JsonSerializableParser implements ParserInterface
* Check for numeric sequential keys, just like the json encoder does * Check for numeric sequential keys, just like the json encoder does
* Credit: http://stackoverflow.com/a/25206156/859027 * Credit: http://stackoverflow.com/a/25206156/859027
* *
* @param array $arr * @param array $arr
* @return bool * @return bool
*/ */
private function isSequential(array $arr) private function isSequential(array $arr)
@ -89,6 +90,7 @@ class JsonSerializableParser implements ParserInterface
return false; return false;
} }
} }
return true; return true;
} }
} }

View File

@ -83,6 +83,7 @@ class ValidationParser implements ParserInterface, PostParserInterface
'readonly' => null, 'readonly' => null,
'children' => $parsed 'children' => $parsed
); );
return $output; return $output;
} }

View File

@ -12,9 +12,9 @@ class DumpCommandTest extends WebTestCase
/** /**
* @dataProvider viewProvider * @dataProvider viewProvider
* *
* @param string $view Command view option value * @param string $view Command view option value
* @param array $expectedMethodsCount Expected resource methods count * @param array $expectedMethodsCount Expected resource methods count
* @param array $expectedMethodValues Expected resource method values * @param array $expectedMethodValues Expected resource method values
*/ */
public function testDumpWithViewOption($view, array $expectedMethodsCount, array $expectedMethodValues) public function testDumpWithViewOption($view, array $expectedMethodsCount, array $expectedMethodValues)
{ {

View File

@ -23,7 +23,8 @@ class ApiDocExtractorTest extends WebTestCase
private static $ROUTES_QUANTITY_PREMIUM = 6; // Routes in the premium view private static $ROUTES_QUANTITY_PREMIUM = 6; // Routes in the premium view
private static $ROUTES_QUANTITY_TEST = 2; // Routes in the test view private static $ROUTES_QUANTITY_TEST = 2; // Routes in the test view
public static function setUpBeforeClass() { public static function setUpBeforeClass()
{
if (class_exists('Dunglas\ApiBundle\DunglasApiBundle')) { if (class_exists('Dunglas\ApiBundle\DunglasApiBundle')) {
self::$ROUTES_QUANTITY_DEFAULT += self::NB_ROUTES_ADDED_BY_DUNGLAS_API_BUNDLE; self::$ROUTES_QUANTITY_DEFAULT += self::NB_ROUTES_ADDED_BY_DUNGLAS_API_BUNDLE;
self::$ROUTES_QUANTITY_PREMIUM += self::NB_ROUTES_ADDED_BY_DUNGLAS_API_BUNDLE; self::$ROUTES_QUANTITY_PREMIUM += self::NB_ROUTES_ADDED_BY_DUNGLAS_API_BUNDLE;

View File

@ -16,6 +16,7 @@ class CachingApiDocExtractorTest extends WebTestCase
$data = ApiDocExtractorTest::dataProviderForViews(); $data = ApiDocExtractorTest::dataProviderForViews();
// remove default view data from provider // remove default view data from provider
array_shift($data); array_shift($data);
return $data; return $data;
} }

View File

@ -3,10 +3,8 @@
* Created by mcfedr on 30/06/15 21:06 * Created by mcfedr on 30/06/15 21:06
*/ */
namespace NelmioApiDocBundle\Tests\Parser; namespace NelmioApiDocBundle\Tests\Parser;
use Nelmio\ApiDocBundle\Parser\JsonSerializableParser; use Nelmio\ApiDocBundle\Parser\JsonSerializableParser;
class JsonSerializableParserTest extends \PHPUnit_Framework_TestCase class JsonSerializableParserTest extends \PHPUnit_Framework_TestCase