public function testPostObjectProducesCorrectParametersForPost() { $key = 'dummy.txt'; // Create the PostObject and fetch the data $post = new PostObject($this->client, $this->bucket); $post->prepareData(); $form = $post->getFormAttributes(); $data = $post->getFormInputs(); // Use Guzzle to simulate a browser POST upload to S3 $http = new Client(array('ssl.certificate_authority' => false)); /** @var $response \Guzzle\Http\Message\Response */ $response = $http->post($form['action'], null, $data)->addPostFiles(array('file' => __DIR__ . DIRECTORY_SEPARATOR . $key))->send(); // Verify that the response is as expected $this->assertEquals(204, $response->getStatusCode()); $this->assertEquals("https://{$this->bucket}.s3.amazonaws.com/{$key}", $response->getLocation()); // Delete the object $this->client->deleteObject(array('Bucket' => $this->bucket, 'Key' => $key)); }
public function testSignsPayload() { $this->client->putObject(array('Bucket' => $this->bucket, 'Key' => 'test2', 'Body' => 'testing...1234')); $this->client->deleteObject(array('Bucket' => $this->bucket, 'Key' => 'test2')); }