public function ClientTest::testUsesPostFilesNestedFields in Zircon Profile 8.0
Same name and namespace in other branches
- 8 vendor/fabpot/goutte/Goutte/Tests/ClientTest.php \Goutte\Tests\ClientTest::testUsesPostFilesNestedFields()
File
- vendor/
fabpot/ goutte/ Goutte/ Tests/ ClientTest.php, line 173
Class
- ClientTest
- Goutte Client Test.
Namespace
Goutte\TestsCode
public function testUsesPostFilesNestedFields() {
$guzzle = $this
->getGuzzle();
$client = new Client();
$client
->setClient($guzzle);
$files = array(
'form' => array(
'test' => array(
'name' => 'test.txt',
'tmp_name' => __DIR__ . '/fixtures.txt',
),
),
);
$client
->request('POST', 'http://www.example.com/', array(), $files);
$request = end($this->history)['request'];
$stream = $request
->getBody();
$boundary = $stream
->getBoundary();
$this
->assertEquals("--{$boundary}\r\nContent-Disposition: form-data; name=\"form[test]\"; filename=\"test.txt\"\r\nContent-Length: 4\r\n" . "Content-Type: text/plain\r\n\r\nfoo\n\r\n--{$boundary}--\r\n", $stream
->getContents());
}