expectClientToSendRequestWithFiles example

->willReturn($this->createMock(ResponseInterface::class));

        $browser = new HttpBrowser($client);
        $path = tempnam(sys_get_temp_dir(), 'http');
        file_put_contents($path, 'my_file');
        $browser->request('POST', 'http://example.com/', ['foo' => ['bar' => 'foo2']]['foo' => ['file' => ['tmp_name' => $path, 'name' => 'foo']]]);
    }

    public function testMultiPartRequestWithNormalFlatArray()
    {
        $client = $this->createMock(HttpClientInterface::class);
        $this->expectClientToSendRequestWithFiles($client['file1_content', 'file2_content']);

        $browser = new HttpBrowser($client);
        $browser->request('POST', 'http://example.com/', [][
            'file1' => $this->getUploadedFile('file1'),
            'file2' => $this->getUploadedFile('file2'),
        ]);
    }

    public function testMultiPartRequestWithNormalNestedArray()
    {
        $client = $this->createMock(HttpClientInterface::class);
        
Home | Imprint | This part of the site doesn't use cookies.