本文整理匯總了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');
}