-
-
Notifications
You must be signed in to change notification settings - Fork 848
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #710 from soyuka/coverage-improvements
Improve coverage file configuration metadata
- Loading branch information
Showing
14 changed files
with
460 additions
and
247 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
resources: | ||
configdummy: | ||
attributes: [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
70 changes: 70 additions & 0 deletions
70
tests/Metadata/Resource/Factory/FileConfigurationMetadataFactoryProvider.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the API Platform project. | ||
* | ||
* (c) Kévin Dunglas <dunglas@gmail.com> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace ApiPlatform\Core\Tests\Metadata\Resource\Factory; | ||
|
||
use ApiPlatform\Core\Metadata\Resource\ResourceMetadata; | ||
|
||
/** | ||
* Resource metadata provider for file configurated factories tests. | ||
* | ||
* @author Antoine Bluchet <soyuka@gmail.com> | ||
*/ | ||
abstract class FileConfigurationMetadataFactoryProvider extends \PHPUnit_Framework_TestCase | ||
{ | ||
public function resourceMetadataProvider() | ||
{ | ||
$resourceMetadata = new ResourceMetadata(); | ||
|
||
$metadata = [ | ||
'shortName' => 'thedummyshortname', | ||
'description' => 'Dummy resource', | ||
'itemOperations' => [ | ||
'my_op_name' => ['method' => 'GET'], | ||
'my_other_op_name' => ['method' => 'POST'], | ||
], | ||
'collectionOperations' => [ | ||
'my_collection_op' => ['method' => 'POST', 'path' => 'the/collection/path'], | ||
], | ||
'iri' => 'someirischema', | ||
'attributes' => [ | ||
'normalization_context' => [ | ||
'groups' => ['default'], | ||
], | ||
'denormalization_context' => [ | ||
'groups' => ['default'], | ||
], | ||
'hydra_context' => [ | ||
'@type' => 'hydra:Operation', | ||
'@hydra:title' => 'File config Dummy', | ||
], | ||
], | ||
]; | ||
|
||
foreach (['shortName', 'description', 'itemOperations', 'collectionOperations', 'iri', 'attributes'] as $property) { | ||
$wither = 'with'.ucfirst($property); | ||
$resourceMetadata = $resourceMetadata->$wither($metadata[$property]); | ||
} | ||
|
||
return [[$resourceMetadata]]; | ||
} | ||
|
||
public function optionalResourceMetadataProvider() | ||
{ | ||
$resourceMetadata = new ResourceMetadata(); | ||
|
||
$resourceMetadata = $resourceMetadata->withItemOperations([ | ||
'my_op_name' => ['method' => 'POST'], | ||
]); | ||
|
||
return [[$resourceMetadata]]; | ||
} | ||
} |
Oops, something went wrong.