/** * testDelete * * @return void * @author Rob Mcvey **/ public function testDelete() { $file = 'public/dots.csv'; $this->AmazonS3->setDate('Mon, 23 Sep 2013 08:46:05 GMT'); // Mock the built request $expectedRequest = array('method' => 'DELETE', 'uri' => array('host' => 'bucket.s3.amazonaws.com', 'scheme' => 'https', 'path' => 'public/dots.csv'), 'header' => array('Accept' => '*/*', 'User-Agent' => 'CakePHP', 'Date' => 'Mon, 23 Sep 2013 08:46:05 GMT', 'Authorization' => 'AWS foo:+UdJAQGhwJf06KRWWIXumX/5V4Y=')); // Mock the HttpSocket response $HttpSocketResponse = new stdClass(); $HttpSocketResponse->body = ''; $HttpSocketResponse->code = 204; $HttpSocketResponse->reasonPhrase = 'No Content'; $HttpSocketResponse->headers = array('x-amz-id-2' => '4589328529385938', 'x-amz-request-id' => 'GSDFGt45egdfsC', 'Date' => 'Mon, 23 Sep 2013 08:46:05 GMT', 'Connection' => 'close', 'Server' => 'AmazonS3'); // Mock the HttpSocket class $this->AmazonS3->HttpSocket = $this->getMock('HttpSocket'); $this->AmazonS3->HttpSocket->expects($this->once())->method('request')->with($expectedRequest)->will($this->returnValue($HttpSocketResponse)); $this->AmazonS3->delete($file); }