HeaderLocationTest.php 956 B

12345678910111213141516171819202122232425262728293031
  1. <?php
  2. namespace GuzzleHttp\Tests\Command\Guzzle\ResponseLocation;
  3. use GuzzleHttp\Command\Guzzle\Parameter;
  4. use GuzzleHttp\Command\Guzzle\ResponseLocation\HeaderLocation;
  5. use GuzzleHttp\Command\Result;
  6. use GuzzleHttp\Psr7\Response;
  7. /**
  8. * @covers \GuzzleHttp\Command\Guzzle\ResponseLocation\HeaderLocation
  9. * @covers \GuzzleHttp\Command\Guzzle\ResponseLocation\AbstractLocation
  10. */
  11. class HeaderLocationTest extends \PHPUnit_Framework_TestCase
  12. {
  13. /**
  14. * @group ResponseLocation
  15. */
  16. public function testVisitsLocation()
  17. {
  18. $location = new HeaderLocation();
  19. $parameter = new Parameter([
  20. 'name' => 'val',
  21. 'sentAs' => 'X-Foo',
  22. 'filters' => ['strtoupper']
  23. ]);
  24. $response = new Response(200, ['X-Foo' => 'bar']);
  25. $result = new Result();
  26. $result = $location->visit($result, $response, $parameter);
  27. $this->assertEquals('BAR', $result['val']);
  28. }
  29. }