BodyLocationTest.php 822 B

1234567891011121314151617181920212223242526
  1. <?php
  2. namespace GuzzleHttp\Tests\Command\Guzzle\RequestLocation;
  3. use GuzzleHttp\Command\Command;
  4. use GuzzleHttp\Command\Guzzle\Parameter;
  5. use GuzzleHttp\Command\Guzzle\RequestLocation\BodyLocation;
  6. use GuzzleHttp\Psr7\Request;
  7. /**
  8. * @covers \GuzzleHttp\Command\Guzzle\RequestLocation\BodyLocation
  9. */
  10. class BodyLocationTest extends \PHPUnit_Framework_TestCase
  11. {
  12. /**
  13. * @group RequestLocation
  14. */
  15. public function testVisitsLocation()
  16. {
  17. $location = new BodyLocation('body');
  18. $command = new Command('foo', ['foo' => 'bar']);
  19. $request = new Request('POST', 'http://httbin.org');
  20. $param = new Parameter(['name' => 'foo']);
  21. $request = $location->visit($command, $request, $param);
  22. $this->assertEquals('foo=bar', $request->getBody()->getContents());
  23. }
  24. }