@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | } |
| 96 | 96 | |
| 97 | 97 | /** |
| 98 | - * @return \PHPUnit_Framework_MockObject_MockObject|\Symfony\Component\HttpKernel\HttpKernelInterface |
|
| 98 | + * @return HttpKernelInterface |
|
| 99 | 99 | */ |
| 100 | 100 | private function createHttpKernelMock() |
| 101 | 101 | { |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | /** |
| 106 | - * @return \PHPUnit_Framework_MockObject_MockObject|\Symfony\Component\HttpFoundation\Request |
|
| 106 | + * @return \Symfony\Component\HttpFoundation\Request |
|
| 107 | 107 | */ |
| 108 | 108 | private function createRequestMock() |
| 109 | 109 | { |
@@ -68,6 +68,9 @@ discard block |
||
| 68 | 68 | return $this->getMock('\JMS\Serializer\SerializerInterface'); |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | + /** |
|
| 72 | + * @param string $data |
|
| 73 | + */ |
|
| 71 | 74 | protected function validateDeserializer($data, $type, $returnValue) |
| 72 | 75 | { |
| 73 | 76 | $this->serializer |
@@ -124,6 +127,9 @@ discard block |
||
| 124 | 127 | return $response; |
| 125 | 128 | } |
| 126 | 129 | |
| 130 | + /** |
|
| 131 | + * @param string $body |
|
| 132 | + */ |
|
| 127 | 133 | protected function validateRequest($method, $uri, array $urlParameters, $body = null, $response = null) |
| 128 | 134 | { |
| 129 | 135 | $request = $this->createRequestMock($response); |
@@ -137,6 +143,12 @@ discard block |
||
| 137 | 143 | return $request; |
| 138 | 144 | } |
| 139 | 145 | |
| 146 | + /** |
|
| 147 | + * @param string $method |
|
| 148 | + * @param string $uri |
|
| 149 | + * @param integer $statusCode |
|
| 150 | + * @param string $type |
|
| 151 | + */ |
|
| 140 | 152 | protected function validateRetrieveApiCall($method, $uri, array $urlParameters, $statusCode, $type, $transformedResult, array $serializerMap = array()) |
| 141 | 153 | { |
| 142 | 154 | $rawResponse = 'the-server-response'; |
@@ -166,6 +178,11 @@ discard block |
||
| 166 | 178 | } |
| 167 | 179 | } |
| 168 | 180 | |
| 181 | + /** |
|
| 182 | + * @param string $method |
|
| 183 | + * @param string $uri |
|
| 184 | + * @param string $rawResponse |
|
| 185 | + */ |
|
| 169 | 186 | protected function validateStoreApiCall($method, $uri, array $urlParameters, $statusCode, $rawResponse, $object, array $serializerMap = array()) |
| 170 | 187 | { |
| 171 | 188 | $rawRequest = 'the-request-body'; |
@@ -181,6 +198,9 @@ discard block |
||
| 181 | 198 | $this->validateSerializer($serializerMap); |
| 182 | 199 | } |
| 183 | 200 | |
| 201 | + /** |
|
| 202 | + * @param string $uri |
|
| 203 | + */ |
|
| 184 | 204 | protected function validateDeleteDocumentCall($uri, array $urlParameters, array $serializerMap = array()) |
| 185 | 205 | { |
| 186 | 206 | $response = $this->createResponseMock(204, ''); |
@@ -83,7 +83,7 @@ |
||
| 83 | 83 | ->serializer |
| 84 | 84 | ->expects($this->any()) |
| 85 | 85 | ->method('serialize') |
| 86 | - ->will($this->returnCallback(function ($data) use ($serializerMap) { |
|
| 86 | + ->will($this->returnCallback(function($data) use ($serializerMap) { |
|
| 87 | 87 | foreach ($serializerMap as $entry) { |
| 88 | 88 | if ($data == $entry['data']) { |
| 89 | 89 | return $entry['result']; |
@@ -68,6 +68,9 @@ |
||
| 68 | 68 | return static::createGroup('Anonymous Group'); |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | + /** |
|
| 72 | + * @param string $name |
|
| 73 | + */ |
|
| 71 | 74 | private static function createGroup($name, Account $account = null) |
| 72 | 75 | { |
| 73 | 76 | $memberAccount = new Account('Member of a group', 'http://example.com/account'); |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | $builder = SerializerBuilder::create(); |
| 37 | 37 | $builder->addMetadataDir(__DIR__.'/../metadata', 'Xabbuh\XApi\Model'); |
| 38 | 38 | $builder->configureListeners( |
| 39 | - function (EventDispatcher $dispatcher) { |
|
| 39 | + function(EventDispatcher $dispatcher) { |
|
| 40 | 40 | $dispatcher->addSubscriber(new ActorEventSubscriber()); |
| 41 | 41 | $dispatcher->addSubscriber(new DocumentDataWrapper()); |
| 42 | 42 | $dispatcher->addSubscriber(new ObjectEventSubscriber()); |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | } |
| 45 | 45 | ); |
| 46 | 46 | $builder->configureHandlers( |
| 47 | - function (HandlerRegistryInterface $registry) { |
|
| 47 | + function(HandlerRegistryInterface $registry) { |
|
| 48 | 48 | $registry->registerSubscribingHandler(new DocumentDataUnwrapper()); |
| 49 | 49 | } |
| 50 | 50 | ); |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | */ |
| 57 | 57 | public static function registerXApiEventSubscriber(SerializerBuilder $builder) |
| 58 | 58 | { |
| 59 | - $builder->configureListeners(function (EventDispatcher $dispatcher) { |
|
| 59 | + $builder->configureListeners(function(EventDispatcher $dispatcher) { |
|
| 60 | 60 | $dispatcher->addSubscriber(new ActorEventSubscriber()); |
| 61 | 61 | $dispatcher->addSubscriber(new DocumentDataWrapper()); |
| 62 | 62 | $dispatcher->addSubscriber(new ObjectEventSubscriber()); |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | */ |
| 72 | 72 | public static function registerXApiHandler(SerializerBuilder $builder) |
| 73 | 73 | { |
| 74 | - $builder->configureHandlers(function (HandlerRegistryInterface $handlerRegistry) { |
|
| 74 | + $builder->configureHandlers(function(HandlerRegistryInterface $handlerRegistry) { |
|
| 75 | 75 | $handlerRegistry->registerSubscribingHandler(new DocumentDataUnwrapper()); |
| 76 | 76 | }); |
| 77 | 77 | } |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | ->expects($this->once()) |
| 77 | 77 | ->method('storeMappedStatement') |
| 78 | 78 | ->with( |
| 79 | - $this->callback(function (MappedStatement $mappedStatement) use ($self, $statement) { |
|
| 79 | + $this->callback(function(MappedStatement $mappedStatement) use ($self, $statement) { |
|
| 80 | 80 | return $self->assertMappedStatement( |
| 81 | 81 | MappedStatement::createFromModel($statement), |
| 82 | 82 | $mappedStatement |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | ->expects($this->once()) |
| 98 | 98 | ->method('storeMappedStatement') |
| 99 | 99 | ->with( |
| 100 | - $this->callback(function (MappedStatement $mappedStatement) use ($self, $statement) { |
|
| 100 | + $this->callback(function(MappedStatement $mappedStatement) use ($self, $statement) { |
|
| 101 | 101 | return $self->assertMappedStatement( |
| 102 | 102 | MappedStatement::createFromModel($statement), |
| 103 | 103 | $mappedStatement |