Skip to content

Commit

Permalink
Added parameters impl to request builder (#15)
Browse files Browse the repository at this point in the history
* Added parameters impl to request builder

* Bring back visibility to be private on client
  • Loading branch information
krzysztofsopa authored May 26, 2020
1 parent 52b65e4 commit 3f3badb
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/Test/RequestBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,13 @@ public function build(): array
return [$this->method, $this->uri, $this->parameters, $this->files, $this->server, $this->content];
}

public function withParameters(array $parameters): self
{
$this->parameters = $parameters;

return $this;
}

public function withMethod(string $method): self
{
$this->method = $method;
Expand Down
15 changes: 15 additions & 0 deletions tests/Test/RequestBuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,21 @@ public function testBuildPostRequest(): void
$this->assertNull($content);
}

public function testBuildPostRequestWithParameters(): void
{
$request = RequestBuilder::aPostRequest();
$request->withParameters(['parameters']);

list($method, $uri, $parameters, $files, $server, $content) = $request->build();

$this->assertEquals('POST', $method);
$this->assertNull($uri);
$this->assertEquals(['parameters'], $parameters);
$this->assertEmpty($files);
$this->assertEmpty($server);
$this->assertNull($content);
}

public function testBuildPutRequest(): void
{
$request = RequestBuilder::aPutRequest();
Expand Down

0 comments on commit 3f3badb

Please sign in to comment.