コード例 #1
0
 public function testDownloadAttachmentShouldNotCallInsertFileWhenZendHttpClientFails()
 {
     $filegallib = TikiLib::lib('filegal');
     $filegallib = $this->getMock('FileGalLib', array('insert_file'));
     $filegallib->expects($this->exactly(0))->method('insert_file');
     $adapter = new Zend\Http\Client\Adapter\Test();
     $adapter->setNextRequestWillFail(true);
     $client = new Zend\Http\Client();
     $client->setAdapter($adapter);
     $obj = $this->getMock('TikiImporter_Blog_Wordpress', array('getHttpClient', 'createFileGallery'));
     $obj->expects($this->once())->method('createFileGallery')->will($this->returnValue(1));
     $obj->expects($this->once())->method('getHttpClient')->will($this->returnValue($client));
     $obj->dom = new DOMDocument();
     $obj->dom->load(dirname(__FILE__) . '/fixtures/wordpress_attachments.xml');
     $obj->downloadAttachments();
     $this->assertEquals(array(), $obj->newFiles);
 }