-
-
Notifications
You must be signed in to change notification settings - Fork 893
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 #600 from api-platform/rename_events
Rename events
- Loading branch information
Showing
16 changed files
with
60 additions
and
59 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,7 +24,7 @@ | |
* | ||
* @author Kévin Dunglas <[email protected]> | ||
*/ | ||
final class ValidatorListener | ||
final class ValidateListener | ||
{ | ||
private $validator; | ||
private $resourceMetadataFactory; | ||
|
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 |
---|---|---|
|
@@ -19,7 +19,7 @@ | |
* | ||
* @author Kévin Dunglas <[email protected]> | ||
*/ | ||
final class FormatListener | ||
final class AddFormatListener | ||
{ | ||
private $negotiator; | ||
private $formats; | ||
|
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 |
---|---|---|
|
@@ -23,7 +23,7 @@ | |
* | ||
* @author Kévin Dunglas <[email protected]> | ||
*/ | ||
final class DeserializerListener | ||
final class DeserializeListener | ||
{ | ||
private $serializer; | ||
private $serializerContextBuilder; | ||
|
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 |
---|---|---|
|
@@ -25,7 +25,7 @@ | |
* | ||
* @author Kévin Dunglas <[email protected]> | ||
*/ | ||
final class DataProviderListener | ||
final class ReadListener | ||
{ | ||
private $collectionDataProvider; | ||
private $itemDataProvider; | ||
|
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 |
---|---|---|
|
@@ -20,7 +20,7 @@ | |
* | ||
* @author Kévin Dunglas <[email protected]> | ||
*/ | ||
final class ResponderListener | ||
final class RespondListener | ||
{ | ||
const METHOD_TO_CODE = [ | ||
Request::METHOD_POST => Response::HTTP_CREATED, | ||
|
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 |
---|---|---|
|
@@ -23,7 +23,7 @@ | |
* | ||
* @author Kévin Dunglas <[email protected]> | ||
*/ | ||
final class SerializerListener | ||
final class SerializeListener | ||
{ | ||
private $serializer; | ||
private $serializerContextBuilder; | ||
|
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 |
---|---|---|
|
@@ -20,7 +20,7 @@ | |
* | ||
* @author Kévin Dunglas <[email protected]> | ||
*/ | ||
final class LinkHeaderListener | ||
final class AddLinkHeaderListener | ||
{ | ||
private $urlGenerator; | ||
|
||
|
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 |
---|---|---|
|
@@ -11,7 +11,7 @@ | |
|
||
namespace ApiPlatform\Core\Tests\Bridge\Symfony\Validator\EventListener; | ||
|
||
use ApiPlatform\Core\Bridge\Symfony\Validator\EventListener\ValidatorListener; | ||
use ApiPlatform\Core\Bridge\Symfony\Validator\EventListener\ValidateListener; | ||
use ApiPlatform\Core\Metadata\Resource\Factory\ResourceMetadataFactoryInterface; | ||
use ApiPlatform\Core\Metadata\Resource\ResourceMetadata; | ||
use ApiPlatform\Core\Tests\Fixtures\DummyEntity; | ||
|
@@ -24,7 +24,7 @@ | |
/** | ||
* @author Samuel ROZE <[email protected]> | ||
*/ | ||
class ValidatorListenerTest extends \PHPUnit_Framework_TestCase | ||
class ValidateListenerTest extends \PHPUnit_Framework_TestCase | ||
{ | ||
public function testValidatorIsCalled() | ||
{ | ||
|
@@ -37,7 +37,7 @@ public function testValidatorIsCalled() | |
|
||
list($resourceMetadataFactory, $event) = $this->createEventObject($expectedValidationGroups, $data); | ||
|
||
$validationViewListener = new ValidatorListener($validator, $resourceMetadataFactory); | ||
$validationViewListener = new ValidateListener($validator, $resourceMetadataFactory); | ||
$validationViewListener->onKernelView($event); | ||
} | ||
|
||
|
@@ -59,7 +59,7 @@ public function testThrowsValidationExceptionWithViolationsFound() | |
|
||
list($resourceMetadataFactory, $event) = $this->createEventObject($expectedValidationGroups, $data); | ||
|
||
$validationViewListener = new ValidatorListener($validator, $resourceMetadataFactory); | ||
$validationViewListener = new ValidateListener($validator, $resourceMetadataFactory); | ||
$validationViewListener->onKernelView($event); | ||
} | ||
|
||
|
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 |
---|---|---|
|
@@ -11,15 +11,15 @@ | |
|
||
namespace ApiPlatform\Core\Tests\EventListener; | ||
|
||
use ApiPlatform\Core\EventListener\FormatListener; | ||
use ApiPlatform\Core\EventListener\AddFormatListener; | ||
use Negotiation\Negotiator; | ||
use Symfony\Component\HttpFoundation\Request; | ||
use Symfony\Component\HttpKernel\Event\GetResponseEvent; | ||
|
||
/** | ||
* @author Kévin Dunglas <[email protected]> | ||
*/ | ||
class FormatListenerTest extends \PHPUnit_Framework_TestCase | ||
class AddFormatListenerTest extends \PHPUnit_Framework_TestCase | ||
{ | ||
public function testNoResourceClass() | ||
{ | ||
|
@@ -29,7 +29,7 @@ public function testNoResourceClass() | |
$eventProphecy->getRequest()->willReturn($request)->shouldBeCalled(); | ||
$event = $eventProphecy->reveal(); | ||
|
||
$listener = new FormatListener(new Negotiator(), []); | ||
$listener = new AddFormatListener(new Negotiator(), []); | ||
$listener->onKernelRequest($event); | ||
|
||
$this->assertFalse($request->attributes->has('_api_format')); | ||
|
@@ -46,7 +46,7 @@ public function testSupportedRequestFormat() | |
$eventProphecy->getRequest()->willReturn($request)->shouldBeCalled(); | ||
$event = $eventProphecy->reveal(); | ||
|
||
$listener = new FormatListener(new Negotiator(), ['text/xml' => 'xml']); | ||
$listener = new AddFormatListener(new Negotiator(), ['text/xml' => 'xml']); | ||
$listener->onKernelRequest($event); | ||
|
||
$this->assertSame('xml', $request->attributes->get('_api_format')); | ||
|
@@ -63,7 +63,7 @@ public function testUnsupportedRequestFormat() | |
$eventProphecy->getRequest()->willReturn($request)->shouldBeCalled(); | ||
$event = $eventProphecy->reveal(); | ||
|
||
$listener = new FormatListener(new Negotiator(), ['application/json' => 'json']); | ||
$listener = new AddFormatListener(new Negotiator(), ['application/json' => 'json']); | ||
$listener->onKernelRequest($event); | ||
|
||
$this->assertSame('json', $request->attributes->get('_api_format')); | ||
|
@@ -80,7 +80,7 @@ public function testSupportedAcceptHeader() | |
$eventProphecy->getRequest()->willReturn($request)->shouldBeCalled(); | ||
$event = $eventProphecy->reveal(); | ||
|
||
$listener = new FormatListener(new Negotiator(), ['application/octet-stream' => 'binary', 'application/json' => 'json']); | ||
$listener = new AddFormatListener(new Negotiator(), ['application/octet-stream' => 'binary', 'application/json' => 'json']); | ||
$listener->onKernelRequest($event); | ||
|
||
$this->assertSame('json', $request->attributes->get('_api_format')); | ||
|
@@ -97,7 +97,7 @@ public function testUnsupportedAcceptHeader() | |
$eventProphecy->getRequest()->willReturn($request)->shouldBeCalled(); | ||
$event = $eventProphecy->reveal(); | ||
|
||
$listener = new FormatListener(new Negotiator(), ['application/octet-stream' => 'binary', 'application/json' => 'json']); | ||
$listener = new AddFormatListener(new Negotiator(), ['application/octet-stream' => 'binary', 'application/json' => 'json']); | ||
$listener->onKernelRequest($event); | ||
|
||
$this->assertSame('binary', $request->attributes->get('_api_format')); | ||
|
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 |
---|---|---|
|
@@ -11,7 +11,7 @@ | |
|
||
namespace ApiPlatform\Core\Tests\EventListener; | ||
|
||
use ApiPlatform\Core\EventListener\DeserializerListener; | ||
use ApiPlatform\Core\EventListener\DeserializeListener; | ||
use ApiPlatform\Core\Serializer\SerializerContextBuilderInterface; | ||
use Prophecy\Argument; | ||
use Symfony\Component\HttpFoundation\Request; | ||
|
@@ -21,7 +21,7 @@ | |
/** | ||
* @author Kévin Dunglas <[email protected]> | ||
*/ | ||
class DeserializerListenerTest extends \PHPUnit_Framework_TestCase | ||
class DeserializeListenerTest extends \PHPUnit_Framework_TestCase | ||
{ | ||
public function testDoNotCallWhenRequestMethodIsSafe() | ||
{ | ||
|
@@ -37,7 +37,7 @@ public function testDoNotCallWhenRequestMethodIsSafe() | |
$serializerContextBuilderProphecy = $this->prophesize(SerializerContextBuilderInterface::class); | ||
$serializerContextBuilderProphecy->createFromRequest(Argument::type(Request::class), false, Argument::type('array'))->shouldNotBeCalled(); | ||
|
||
$listener = new DeserializerListener($serializerProphecy->reveal(), $serializerContextBuilderProphecy->reveal()); | ||
$listener = new DeserializeListener($serializerProphecy->reveal(), $serializerContextBuilderProphecy->reveal()); | ||
$listener->onKernelRequest($eventProphecy->reveal()); | ||
} | ||
|
||
|
@@ -55,7 +55,7 @@ public function testDoNotCallWhenRequestNotManaged() | |
$serializerContextBuilderProphecy = $this->prophesize(SerializerContextBuilderInterface::class); | ||
$serializerContextBuilderProphecy->createFromRequest(Argument::type(Request::class), false, Argument::type('array'))->shouldNotBeCalled(); | ||
|
||
$listener = new DeserializerListener($serializerProphecy->reveal(), $serializerContextBuilderProphecy->reveal()); | ||
$listener = new DeserializeListener($serializerProphecy->reveal(), $serializerContextBuilderProphecy->reveal()); | ||
$listener->onKernelRequest($eventProphecy->reveal()); | ||
} | ||
|
||
|
@@ -78,7 +78,7 @@ public function testDeserialize(string $method, bool $populateObject) | |
$serializerContextBuilderProphecy = $this->prophesize(SerializerContextBuilderInterface::class); | ||
$serializerContextBuilderProphecy->createFromRequest(Argument::type(Request::class), false, Argument::type('array'))->willReturn([])->shouldBeCalled(); | ||
|
||
$listener = new DeserializerListener($serializerProphecy->reveal(), $serializerContextBuilderProphecy->reveal()); | ||
$listener = new DeserializeListener($serializerProphecy->reveal(), $serializerContextBuilderProphecy->reveal()); | ||
$listener->onKernelRequest($eventProphecy->reveal()); | ||
} | ||
|
||
|
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 |
---|---|---|
|
@@ -13,14 +13,14 @@ | |
|
||
use ApiPlatform\Core\DataProvider\CollectionDataProviderInterface; | ||
use ApiPlatform\Core\DataProvider\ItemDataProviderInterface; | ||
use ApiPlatform\Core\EventListener\DataProviderListener; | ||
use ApiPlatform\Core\EventListener\ReadListener; | ||
use Symfony\Component\HttpFoundation\Request; | ||
use Symfony\Component\HttpKernel\Event\GetResponseEvent; | ||
|
||
/** | ||
* @author Kévin Dunglas <[email protected]> | ||
*/ | ||
class DataProviderListenerTest extends \PHPUnit_Framework_TestCase | ||
class ReadListenerTest extends \PHPUnit_Framework_TestCase | ||
{ | ||
public function testNotAnApiPlatformRequest() | ||
{ | ||
|
@@ -35,7 +35,7 @@ public function testNotAnApiPlatformRequest() | |
$event = $this->prophesize(GetResponseEvent::class); | ||
$event->getRequest()->willReturn($request)->shouldBeCalled(); | ||
|
||
$listener = new DataProviderListener($collectionDataProvider->reveal(), $itemDataProvider->reveal()); | ||
$listener = new ReadListener($collectionDataProvider->reveal(), $itemDataProvider->reveal()); | ||
$listener->onKernelRequest($event->reveal()); | ||
} | ||
|
||
|
@@ -53,7 +53,7 @@ public function testRetrieveCollectionPost() | |
$event = $this->prophesize(GetResponseEvent::class); | ||
$event->getRequest()->willReturn($request)->shouldBeCalled(); | ||
|
||
$listener = new DataProviderListener($collectionDataProvider->reveal(), $itemDataProvider->reveal()); | ||
$listener = new ReadListener($collectionDataProvider->reveal(), $itemDataProvider->reveal()); | ||
$listener->onKernelRequest($event->reveal()); | ||
|
||
$this->assertTrue($request->attributes->has('data')); | ||
|
@@ -74,7 +74,7 @@ public function testRetrieveCollectionGet() | |
$event = $this->prophesize(GetResponseEvent::class); | ||
$event->getRequest()->willReturn($request)->shouldBeCalled(); | ||
|
||
$listener = new DataProviderListener($collectionDataProvider->reveal(), $itemDataProvider->reveal()); | ||
$listener = new ReadListener($collectionDataProvider->reveal(), $itemDataProvider->reveal()); | ||
$listener->onKernelRequest($event->reveal()); | ||
|
||
$this->assertSame([], $request->attributes->get('data')); | ||
|
@@ -95,7 +95,7 @@ public function testRetrieveItem() | |
$event = $this->prophesize(GetResponseEvent::class); | ||
$event->getRequest()->willReturn($request)->shouldBeCalled(); | ||
|
||
$listener = new DataProviderListener($collectionDataProvider->reveal(), $itemDataProvider->reveal()); | ||
$listener = new ReadListener($collectionDataProvider->reveal(), $itemDataProvider->reveal()); | ||
$listener->onKernelRequest($event->reveal()); | ||
|
||
$this->assertSame($data, $request->attributes->get('data')); | ||
|
@@ -117,7 +117,7 @@ public function testRetrieveItemNotFound() | |
$event = $this->prophesize(GetResponseEvent::class); | ||
$event->getRequest()->willReturn($request)->shouldBeCalled(); | ||
|
||
$listener = new DataProviderListener($collectionDataProvider->reveal(), $itemDataProvider->reveal()); | ||
$listener = new ReadListener($collectionDataProvider->reveal(), $itemDataProvider->reveal()); | ||
$listener->onKernelRequest($event->reveal()); | ||
} | ||
} |
Oops, something went wrong.