Skip to content

Commit

Permalink
Adding tests for set request and response filters
Browse files Browse the repository at this point in the history
  • Loading branch information
jenssegers committed Aug 16, 2014
1 parent 8fb9de0 commit ea356e7
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Proxy.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public function to($target)
*
* @param array $filters
*/
public function setRequestFilter(array $filters)
public function setRequestFilters(array $filters)
{
$this->requestFilters = $filters;
}
Expand All @@ -108,7 +108,7 @@ public function addRequestFilter(RequestFilterInterface $filter)
*
* @param array $filters
*/
public function setResponseFilter(array $filters)
public function setResponseFilters(array $filters)
{
$this->responseFilters = $filters;
}
Expand Down
32 changes: 32 additions & 0 deletions tests/Proxy/ProxyTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,38 @@ public function to_applies_request_filters()
$this->proxy->forward(Request::createFromGlobals())->to('/');
}

/**
* @test
*/
public function to_applies_response_filters_from_set()
{
$filter = $this->getMockBuilder('\Proxy\Response\Filter\ResponseFilterInterface')
->getMock();

$filter->expects($this->once())
->method('filter');

$this->proxy->setResponseFilters([$filter]);

$this->proxy->forward(Request::createFromGlobals())->to('/');
}

/**
* @test
*/
public function to_applies_request_filters_from_set()
{
$filter = $this->getMockBuilder('\Proxy\Request\Filter\RequestFilterInterface')
->getMock();

$filter->expects($this->once())
->method('filter');

$this->proxy->setRequestFilters([$filter]);

$this->proxy->forward(Request::createFromGlobals())->to('/');
}

/**
* @test
*/
Expand Down

0 comments on commit ea356e7

Please sign in to comment.