Révision a1cafe7e
Ajouté par Assos Assos il y a plus de 4 ans
drupal7/sites/all/modules/field_collection/field_collection.test | ||
---|---|---|
70 | 70 |
if (!isset($message)) { |
71 | 71 |
$message = $text; |
72 | 72 |
} |
73 |
return $this->assertTrue(array_search($text, $_SESSION['entity_crud_hook_test']) !== FALSE, $message, $group);
|
|
73 |
return $this->assertTrue(in_array($text, $_SESSION['entity_crud_hook_test']), $message, $group);
|
|
74 | 74 |
} |
75 | 75 |
|
76 | 76 |
/** |
... | ... | |
95 | 95 |
if (!isset($message)) { |
96 | 96 |
$message = $text; |
97 | 97 |
} |
98 |
return $this->assertFalse(array_search($text, $_SESSION['entity_crud_hook_test']) !== FALSE, $message, $group);
|
|
98 |
return $this->assertFalse(in_array($text, $_SESSION['entity_crud_hook_test']), $message, $group);
|
|
99 | 99 |
} |
100 | 100 |
|
101 | 101 |
/** |
... | ... | |
153 | 153 |
$this->clearHookMessages(); |
154 | 154 |
node_delete($node->nid); |
155 | 155 |
$this->assertNoHookMessage('entity_crud_hook_test_entity_presave called for type node'); |
156 |
$this->assertTrue(entity_load('field_collection_item', FALSE) === array(), 'Field collections are deleted when the host is deleted.');
|
|
156 |
$this->assertTrue(entity_load('field_collection_item') === array(), 'Field collections are deleted when the host is deleted.'); |
|
157 | 157 |
|
158 | 158 |
// Try deleting nodes with collections without any values. |
159 | 159 |
$node = $this->drupalCreateNode(array('type' => 'article')); |
... | ... | |
344 | 344 |
$this->drupalPost($path, $edit, t('Save')); |
345 | 345 |
$this->assertText(t('The changes have been saved.'), 'Field collection saved.'); |
346 | 346 |
|
347 |
$this->assertText($edit['field_text[und][0][value]'], "Added field value is shown.");
|
|
347 |
$this->assertText($edit['field_text[und][0][value]'], 'Added field value is shown.');
|
|
348 | 348 |
|
349 | 349 |
$edit['field_text[und][0][value]'] = $this->randomName(); |
350 | 350 |
$this->drupalPost('field-collection/field-test-collection/1/edit', $edit, t('Save')); |
351 | 351 |
$this->assertText(t('The changes have been saved.'), 'Field collection saved.'); |
352 |
$this->assertText($edit['field_text[und][0][value]'], "Field collection has been edited.");
|
|
352 |
$this->assertText($edit['field_text[und][0][value]'], 'Field collection has been edited.');
|
|
353 | 353 |
|
354 | 354 |
$this->drupalGet('field-collection/field-test-collection/1'); |
355 |
$this->assertText($edit['field_text[und][0][value]'], "Field collection can be viewed.");
|
|
355 |
$this->assertText($edit['field_text[und][0][value]'], 'Field collection can be viewed.');
|
|
356 | 356 |
|
357 | 357 |
// Add further 3 items, so we have reached 4 == maxium cardinality. |
358 | 358 |
$this->drupalPost($path, $edit, t('Save')); |
... | ... | |
737 | 737 |
|
738 | 738 |
// Make sure we are not using a stale list. |
739 | 739 |
drupal_static_reset('language_list'); |
740 |
$languages = language_list('language');
|
|
740 |
$languages = language_list(); |
|
741 | 741 |
$this->assertTrue(array_key_exists($langcode, $languages), t('Language was installed successfully.')); |
742 | 742 |
|
743 | 743 |
if (array_key_exists($langcode, $languages)) { |
... | ... | |
1013 | 1013 |
$field = field_info_field($field_name); |
1014 | 1014 |
$field_value = array(); |
1015 | 1015 |
// Copy the value of the translated field if it's translatable. |
1016 |
if ($field['translatable']) { |
|
1017 |
if (isset($node->{$field_name}[$node->language])) { |
|
1018 |
$field_value = $node->{$field_name}[$source_langcode]; |
|
1019 |
$values[$field_name][$langcode] = $field_value; |
|
1020 |
$node->{$field_name}[$langcode] = $field_value; |
|
1021 |
} |
|
1016 |
if ($field['translatable'] |
|
1017 |
&& isset($node->{$field_name}[$node->language])) { |
|
1018 |
$field_value = $node->{$field_name}[$source_langcode]; |
|
1019 |
$values[$field_name][$langcode] = $field_value; |
|
1020 |
$node->{$field_name}[$langcode] = $field_value; |
|
1022 | 1021 |
} |
1023 | 1022 |
} |
1024 | 1023 |
|
Formats disponibles : Unified diff
Weekly update of contrib modules