Skip to content

Commit

Permalink
Bug with post upload.
Browse files Browse the repository at this point in the history
  • Loading branch information
amouhzi committed Nov 4, 2013
1 parent 7bdc952 commit fda3c6e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions tests/CurlTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public function testPostMultidimensionalData() {
$this->curl->post($this->test_url . 'post_multidimensional.php', $data);

$this->assertEquals(
'test=post_multidimensional&key=file&file%5B0%5D=wibble&file%5B1%5D=wubble&file%5B2%5D=wobble',
'key=file&file%5B0%5D=wibble&file%5B1%5D=wubble&file%5B2%5D=wobble',
$this->curl->response);

}
Expand All @@ -86,7 +86,14 @@ public function testPostFilePathUpload() {

$data = array(
'key' => 'image',
'image' => '@' . $file_path,
'image' => "@" . $file_path,
);

$image = file_get_contents($file_path);

$data = array(
'key' => 'image',
'image' => $image,
);

$this->curl->post($this->test_url . 'post_file_path_upload.php', $data);
Expand All @@ -97,7 +104,7 @@ public function testPostFilePathUpload() {
'key' => 'image',
'mime_content_type' => 'image/png'
),
json_decode($this->curl->response));
json_decode($this->curl->response, true));

unlink($file_path);
}
Expand Down Expand Up @@ -146,7 +153,8 @@ public function testDelete() {

public function testBasicHttpAuth() {

$data = array();
$data = array();

$this->curl->get($this->test_url . 'http_basic_auth.php', $data);

$this->assertEquals('canceled', $this->curl->response);
Expand All @@ -156,9 +164,11 @@ public function testBasicHttpAuth() {

$this->curl->setBasicAuthentication($username, $password);

$json = json_decode($this->curl->response);
$this->assertTrue($json->username === $username);
$this->assertTrue($json->password === $password);
$this->curl->get($this->test_url . 'http_basic_auth.php', $data);

$this->assertEquals(
'{"username":"myusername","password":"mypassword"}',
$this->curl->response);
}

public function testReferrer() {
Expand Down
Binary file added tests/data/test.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit fda3c6e

Please sign in to comment.