Skip to content

Fix interface update in message factory #15

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 31, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions spec/MessageFactory/DiactorosFactorySpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,26 +32,26 @@ function it_creates_a_request()

function it_creates_a_request_with_string_body()
{
$this->createRequest('POST', '/', '1.1', [], 'body')->shouldHaveType('Psr\Http\Message\RequestInterface');
$this->createRequest('POST', '/', [], 'body', '1.1')->shouldHaveType('Psr\Http\Message\RequestInterface');
}

function it_creates_a_request_with_empty_body()
{
$this->createRequest('POST', '/', '1.1', [], null)->shouldHaveType('Psr\Http\Message\RequestInterface');
$this->createRequest('POST', '/', [], null, '1.1')->shouldHaveType('Psr\Http\Message\RequestInterface');
}

function it_creates_a_request_with_stream_body(StreamInterface $stream)
{
$stream->rewind()->shouldBeCalled();

$this->createRequest('POST', '/', '1.1', [], $stream)->shouldHaveType('Psr\Http\Message\RequestInterface');
$this->createRequest('POST', '/', [], $stream, '1.1')->shouldHaveType('Psr\Http\Message\RequestInterface');
}

function it_creates_a_request_with_resource_body()
{
$resource = tmpfile();

$this->createRequest('POST', '/', '1.1', [], $resource)->shouldHaveType('Psr\Http\Message\RequestInterface');
$this->createRequest('POST', '/', [], $resource, '1.1')->shouldHaveType('Psr\Http\Message\RequestInterface');
}

function it_creates_a_response()
Expand Down
8 changes: 4 additions & 4 deletions src/MessageFactory/DiactorosFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ class DiactorosFactory implements MessageFactory
public function createRequest(
$method,
$uri,
$protocolVersion = '1.1',
array $headers = [],
$body = null
$body = null,
$protocolVersion = '1.1'
) {
return (new Request(
$uri,
Expand All @@ -46,9 +46,9 @@ public function createRequest(
public function createResponse(
$statusCode = 200,
$reasonPhrase = null,
$protocolVersion = '1.1',
array $headers = [],
$body = null
$body = null,
$protocolVersion = '1.1'
) {
return (new Response(
$this->createStream($body),
Expand Down
8 changes: 4 additions & 4 deletions src/MessageFactory/GuzzleFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ class GuzzleFactory implements MessageFactory
public function createRequest(
$method,
$uri,
$protocolVersion = '1.1',
array $headers = [],
$body = null
$body = null,
$protocolVersion = '1.1'
) {
return new Request(
$method,
Expand All @@ -45,9 +45,9 @@ public function createRequest(
public function createResponse(
$statusCode = 200,
$reasonPhrase = null,
$protocolVersion = '1.1',
array $headers = [],
$body = null
$body = null,
$protocolVersion = '1.1'
) {
return new Response(
$statusCode,
Expand Down