Commit c60ef137 authored by Guillaume Perréal's avatar Guillaume Perréal
Browse files

CS.

parent ba03eb82
No related merge requests found
Showing with 29 additions and 17 deletions
+29 -17
......@@ -122,8 +122,8 @@ class ObjectMetadataNormalizer implements NormalizerAwareInterface, NormalizerIn
],
$data,
[
'operations' => (object)$operations,
'definitions' => (object)($defs->getArrayCopy()),
'operations' => (object) $operations,
'definitions' => (object) ($defs->getArrayCopy()),
]
);
}
......
......@@ -107,7 +107,7 @@ class ObjectMetadata implements TypeMetadata
}
return [
'properties' => $properties ?: (object)[],
'properties' => $properties ?: (object) [],
'required' => $required,
'additionalProperties' => false,
];
......
......@@ -107,9 +107,9 @@ class FunctionalTest extends WebTestCase
self::assertEquals(
[
'$id' => 'http://localhost/metadata',
'$id' => 'http://localhost/metadata',
'resources' => [
'User' => ['$ref' => 'User'],
'User' => ['$ref' => 'User'],
'Person' => ['$ref' => 'Person'],
],
],
......@@ -118,8 +118,9 @@ class FunctionalTest extends WebTestCase
}
/**
* @return SchemaContract
* @throws \Exception
*
* @return SchemaContract
*/
public function testJsonSchemaValidity(): SchemaContract
{
......@@ -129,6 +130,7 @@ class FunctionalTest extends WebTestCase
$schema = Schema::import('/metadata/Person', $options);
self::assertInstanceOf(SchemaContract::class, $schema);
return $schema;
}
......@@ -136,6 +138,7 @@ class FunctionalTest extends WebTestCase
* @depends testJsonSchemaValidity
*
* @param SchemaContract $schema
*
* @throws InvalidValue
* @throws JsonException
*/
......
<?php declare(strict_types=1);
/**
/*
* This file is part of "irstea/api-metadata".
*
* Copyright (C) 2019 IRSTEA
* All rights reserved.
*
* @copyright 2019 IRSTEA
* @author guillaume.perreal
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation, either version 3 of the License, or (at your option) any
* later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
* PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License and the GNU
* Lesser General Public License along with this program. If not, see
* <https://www.gnu.org/licenses/>.
*/
namespace Irstea\ApiMetadata\Tests;
use Swaggest\JsonSchema\RemoteRefProvider;
use Symfony\Component\BrowserKit\Client;
use Symfony\Component\HttpFoundation\Response;
/**
* Class TestRemoteRefProvider
* Class TestRemoteRefProvider.
*/
class TestRemoteRefProvider implements RemoteRefProvider
{
......@@ -27,16 +36,16 @@ class TestRemoteRefProvider implements RemoteRefProvider
/**
* TestRemoteRefProvider constructor.
*
* @param Client $client
*/
public function __construct(Client $client)
{
$this->client = $client;
}
/**
* @inheritDoc
* {@inheritdoc}
*/
public function getSchemaData($url)
{
......@@ -46,7 +55,7 @@ class TestRemoteRefProvider implements RemoteRefProvider
$response = $this->client->getResponse();
$json = $response->getContent();
return (object)json_decode($json);
}
return (object) json_decode($json);
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment