MultiPartLocationTest.php 1.1 KB

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. namespace GuzzleHttp\Tests\Command\Guzzle\RequestLocation;
  3. use GuzzleHttp\Command\Command;
  4. use GuzzleHttp\Command\Guzzle\Operation;
  5. use GuzzleHttp\Command\Guzzle\Parameter;
  6. use GuzzleHttp\Command\Guzzle\RequestLocation\MultiPartLocation;
  7. use GuzzleHttp\Command\Guzzle\RequestLocation\PostFileLocation;
  8. use GuzzleHttp\Psr7\Request;
  9. /**
  10. * @covers \GuzzleHttp\Command\Guzzle\RequestLocation\MultiPartLocation
  11. */
  12. class MultiPartLocationTest extends \PHPUnit_Framework_TestCase
  13. {
  14. /**
  15. * @group RequestLocation
  16. */
  17. public function testVisitsLocation()
  18. {
  19. $location = new MultiPartLocation();
  20. $command = new Command('foo', ['foo' => 'bar']);
  21. $request = new Request('POST', 'http://httbin.org', []);
  22. $param = new Parameter(['name' => 'foo']);
  23. $request = $location->visit($command, $request, $param);
  24. $operation = new Operation();
  25. $request = $location->after($command, $request, $operation);
  26. $actual = $request->getBody()->getContents();
  27. $this->assertNotFalse(strpos($actual, 'name="foo"'));
  28. $this->assertNotFalse(strpos($actual, 'bar'));
  29. }
  30. }