Skip to content
This repository has been archived by the owner on Jul 19, 2024. It is now read-only.

Commit

Permalink
Apply fixes from StyleCI (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewgoslett authored May 24, 2017
1 parent 9c7c50f commit ca4bb08
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
8 changes: 5 additions & 3 deletions src/HTTPPubSubAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ public function setUri($uri)
}

/**
*
* Return the uri of the service where messages will be published to.
*
* @return string
Expand Down Expand Up @@ -119,6 +118,7 @@ public function getGlobalHeaders()
* @param string $endpoint
* @param mixed $body
* @param array $headers
*
* @return Request
*/
protected function createRequest($method, $endpoint, $body = null, array $headers = [])
Expand All @@ -132,12 +132,13 @@ protected function createRequest($method, $endpoint, $body = null, array $header
* Send an HTTP request.
*
* @param RequestInterface $request
*
* @return array
*/
protected function sendRequest(RequestInterface $request)
{
$response = $this->client->send($request);
/** @var \Psr\Http\Message\ResponseInterface $response */
/* @var \Psr\Http\Message\ResponseInterface $response */

return json_decode($response->getBody(), true);
}
Expand All @@ -147,6 +148,7 @@ protected function sendRequest(RequestInterface $request)
*
* @param string $endpoint
* @param array $data
*
* @return mixed
*/
public function post($endpoint, array $data = [])
Expand Down Expand Up @@ -188,4 +190,4 @@ public function publishBatch($channel, array $messages)
{
$this->post(sprintf('messages/%s', $channel), ['messages' => $messages]);
}
}
}
16 changes: 8 additions & 8 deletions tests/HTTPPubSubAdapterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public function testPost()
'POST',
'messages/test',
json_encode(['messages' => ['hello', 'world']]),
['Content-Type' => 'application/json']
['Content-Type' => 'application/json'],
])
->once()
->andReturn($request);
Expand All @@ -103,7 +103,7 @@ public function testSubscribe()
$subscribeAdapter->shouldReceive('subscribe')
->withArgs([
'test',
$handler
$handler,
])
->once();

Expand All @@ -127,9 +127,9 @@ public function testPublish()
'messages' => [
[
'hello' => 'world',
]
],
],
]
],
])
->once();
$adapter->publish('test', ['hello' => 'world']);
Expand All @@ -151,17 +151,17 @@ public function testPublishBatch()
'test',
[
'hello' => 'world',
]
],
],
]
],
])
->once();
$messages = [
'test',
[
'hello' => 'world',
]
],
];
$adapter->publishBatch('test', $messages);
}
}
}

0 comments on commit ca4bb08

Please sign in to comment.