Skip to content

Commit

Permalink
EZP-29234: As a developer, I want to read about customizing REST API …
Browse files Browse the repository at this point in the history
…response (ezsystems#986)

* EZP-29234: As a developer, I want to read about customizing REST API response

* added dependency to kernel branch, don't merge

* set composer to not check via SSH for publish fork

* travis setting for using kernel branch
  • Loading branch information
konradoboza authored and andrerom committed Sep 20, 2018
1 parent 693e4a4 commit 62b681c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 20 deletions.
5 changes: 4 additions & 1 deletion Resources/config/services.yml
Expand Up @@ -52,6 +52,8 @@ parameters:
# To disable set to 0.
ezsystems.platformui.application_config.combo_loader.cache_ttl: 604800

ezsystems.platformui.rest.generator.json.vendor: 'vnd.ez.platformui'

ezsystems.platformui.rest.output.visitor.json.regexps:
- '(^application/vnd\.ez\.platformui\.[A-Za-z]+\+json$)'
services:
Expand Down Expand Up @@ -282,9 +284,10 @@ services:
- { name: ezpublish_rest.field_type_processor, alias: ezuser }

ezsystems.platformui.rest.output.generator.json:
class: EzSystems\PlatformUIBundle\Rest\Generator\Json
class: eZ\Publish\Core\REST\Common\Output\Generator\Json
arguments:
- "@ezpublish_rest.output.generator.json.field_type_hash_generator"
- "%ezsystems.platformui.rest.generator.json.vendor%"
calls:
- [ setFormatOutput, [ "%kernel.debug%" ] ]

Expand Down
17 changes: 0 additions & 17 deletions Rest/Generator/Json.php

This file was deleted.

5 changes: 3 additions & 2 deletions Tests/Rest/Generator/JsonTest.php
Expand Up @@ -7,14 +7,15 @@
namespace EzSystems\PlatformUIBundle\Tests\Rest\Generator;

use eZ\Publish\Core\REST\Common\Output\Generator\Json\FieldTypeHashGenerator;
use EzSystems\PlatformUIBundle\Rest\Generator\Json;
use eZ\Publish\Core\REST\Common\Output\Generator\Json;
use PHPUnit\Framework\TestCase;

class JsonTest extends TestCase
{
public function testGetMediaType()
{
$mediaType = (new Json($this->getMock(FieldTypeHashGenerator::class)))->getMediaType('Object');
$vendor = 'vnd.ez.platformui';
$mediaType = (new Json($this->getMock(FieldTypeHashGenerator::class), $vendor))->getMediaType('Object');

$this->assertEquals('application/vnd.ez.platformui.Object+json', $mediaType);
}
Expand Down

0 comments on commit 62b681c

Please sign in to comment.