本文整理汇总了PHP中CComponent::prepareExportDeliverable方法的典型用法代码示例。如果您正苦于以下问题:PHP CComponent::prepareExportDeliverable方法的具体用法?PHP CComponent::prepareExportDeliverable怎么用?PHP CComponent::prepareExportDeliverable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CComponent
的用法示例。
在下文中一共展示了CComponent::prepareExportDeliverable方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testPrepareExportDeliverable
/**
* Verify correct operation of {@link prepareExportDeliverable}.
* Currently, the exportDestinations with test cases include: download, server, ftp, scp
* exportDestinations remaining to be tested: s3, gdrive
*/
public function testPrepareExportDeliverable()
{
$component = new CComponent();
$component->attachBehavior('importexport', new ImportExportBehavior());
$testfile = implode(DIRECTORY_SEPARATOR, array(Yii::app()->basePath, 'tests', 'data', 'csvs', 'contacts.csv'));
// Ensure failure when the exportDestination is not specified
$ret = $component->prepareExportDeliverable($testfile, array());
$this->assertFalse($ret);
// Test standard browser download method
$params = array('exportDestination' => 'download');
$ret = $component->prepareExportDeliverable($testfile, $params);
$this->assertTrue($ret);
$params['compressOutput'] = true;
$ret = $component->prepareExportDeliverable($testfile, $params);
$this->assertTrue($ret);
$this->assertFileExists($component->safePath('contacts.zip'));
unlink($component->safePath('contacts.zip'));
}