本文整理汇总了PHP中UploadField::config方法的典型用法代码示例。如果您正苦于以下问题:PHP UploadField::config方法的具体用法?PHP UploadField::config怎么用?PHP UploadField::config使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UploadField
的用法示例。
在下文中一共展示了UploadField::config方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testConfigOverwriteWarningCannotRelaceFiles
/**
* Test that UploadField:overwriteWarning cannot overwrite Upload:replaceFile
*/
public function testConfigOverwriteWarningCannotRelaceFiles()
{
Upload::config()->replaceFile = false;
UploadField::config()->defaultConfig = array_merge(UploadField::config()->defaultConfig, array('overwriteWarning' => true));
$tmpFileName = 'testUploadBasic.txt';
$response = $this->mockFileUpload('NoRelationField', $tmpFileName);
$this->assertFalse($response->isError());
$responseData = Convert::json2array($response->getBody());
$uploadedFile = DataObject::get_by_id('File', (int) $responseData[0]['id']);
$this->assertTrue(is_object($uploadedFile), 'The file object is created');
$this->assertFileExists(AssetStoreTest_SpyStore::getLocalPath($uploadedFile));
$tmpFileName = 'testUploadBasic.txt';
$response = $this->mockFileUpload('NoRelationField', $tmpFileName);
$this->assertFalse($response->isError());
$responseData = Convert::json2array($response->getBody());
$uploadedFile2 = DataObject::get_by_id('File', (int) $responseData[0]['id']);
$this->assertTrue(is_object($uploadedFile2), 'The file object is created');
$this->assertFileExists(AssetStoreTest_SpyStore::getLocalPath($uploadedFile2));
$this->assertTrue($uploadedFile->Filename !== $uploadedFile2->Filename, 'Filename is not the same');
$this->assertTrue($uploadedFile->ID !== $uploadedFile2->ID, 'File database record is not the same');
}