Révision 6ff32cea
Ajouté par Florent Torregrosa il y a environ 9 ans
drupal7/modules/file/tests/file.test | ||
---|---|---|
474 | 474 |
$node_file = (object) $node->{$field_name}[LANGUAGE_NONE][0]; |
475 | 475 |
$this->assertFileExists($node_file, 'New file saved to disk on node creation.'); |
476 | 476 |
|
477 |
// Test that running field_attach_update() leaves the file intact. |
|
478 |
$field = new stdClass(); |
|
479 |
$field->type = $type_name; |
|
480 |
$field->nid = $nid; |
|
481 |
field_attach_update('node', $field); |
|
482 |
$node = node_load($nid); |
|
483 |
$node_file = (object) $node->{$field_name}[LANGUAGE_NONE][0]; |
|
484 |
$this->assertFileExists($node_file, 'New file still saved to disk on field update.'); |
|
485 |
|
|
477 | 486 |
// Ensure the file can be downloaded. |
478 | 487 |
$this->drupalGet(file_create_url($node_file->uri)); |
479 | 488 |
$this->assertResponse(200, 'Confirmed that the generated URL is correct by downloading the shipped file.'); |
... | ... | |
877 | 886 |
$field_settings = array( |
878 | 887 |
'display_field' => '1', |
879 | 888 |
'display_default' => '1', |
889 |
'cardinality' => FIELD_CARDINALITY_UNLIMITED, |
|
880 | 890 |
); |
881 | 891 |
$instance_settings = array( |
882 | 892 |
'description_field' => '1', |
... | ... | |
917 | 927 |
|
918 | 928 |
$this->assertNoRaw($default_output, 'Field is hidden when "display" option is unchecked.'); |
919 | 929 |
|
930 |
// Test that fields appear as expected during the preview. |
|
931 |
// Add a second file. |
|
932 |
$name = 'files[' . $field_name . '_' . LANGUAGE_NONE . '_1]'; |
|
933 |
$edit[$name] = drupal_realpath($test_file->uri); |
|
934 |
|
|
935 |
// Uncheck the display checkboxes and go to the preview. |
|
936 |
$edit[$field_name . '[' . LANGUAGE_NONE . '][0][display]'] = FALSE; |
|
937 |
$edit[$field_name . '[' . LANGUAGE_NONE . '][1][display]'] = FALSE; |
|
938 |
$this->drupalPost('node/' . $nid . '/edit', $edit, t('Preview')); |
|
939 |
$this->assertRaw($field_name . '[' . LANGUAGE_NONE . '][0][display]', 'First file appears as expected.'); |
|
940 |
$this->assertRaw($field_name . '[' . LANGUAGE_NONE . '][1][display]', 'Second file appears as expected.'); |
|
920 | 941 |
} |
921 | 942 |
} |
922 | 943 |
|
Formats disponibles : Unified diff
Update core to 7.36