assertType('Zend_Service_Nirvanix_Namespace_Base', $imfs); } // putContents() public function testPutContents() { $imfs = $this->nirvanix->getService('IMFS'); // response for call to GetStorageNode $this->httpAdapter->addResponse( $this->makeNirvanixResponse( array('ResponseCode' => '0', 'GetStorageNode' => 'node1.nirvanix.com bar')) ); $imfs->putContents('/foo', 'contents for foo'); } // getContents() public function testGetContents() { $imfs = $this->nirvanix->getService('IMFS'); // response for call to GetOptimalUrlss $this->httpAdapter->addResponse( $this->makeNirvanixResponse( array('ResponseCode' => '0', 'Download' => 'http://get-it-here')) ); // response for file download $this->httpAdapter->addResponse( $this->makeHttpResponseFrom('contents for foo') ); $actual = $imfs->getContents('/foo.txt'); $expected = $this->httpClient->getLastResponse()->getBody(); $this->assertEquals($expected, $actual); } // unlink() public function testUnlink() { $imfs = $this->nirvanix->getService('IMFS'); // response for call to DeleteFiles $this->httpAdapter->addResponse( $this->makeNirvanixResponse(array('ResponseCode' => '0')) ); $imfs->unlink('foo'); } /** * @issue ZF-6860 */ public function testDestinationPathFormatSentToServiceAsParameterUsesUnixConvention() { $imfs = $this->nirvanix->getService('IMFS'); $this->httpAdapter->addResponse( $this->makeNirvanixResponse( array('ResponseCode' => '0', 'GetStorageNode' => 'node1.nirvanix.com bar')) ); // little unix cheat to force a backslash into the IFS path $imfs->putContents('.\foo/bar', 'contents for foo'); $this->assertContains('./foo', $imfs->getHttpClient()->getLastRequest()); } }