Révision 950416da
Ajouté par Assos Assos il y a plus de 5 ans
drupal7/sites/all/modules/field_collection/field_collection.test | ||
---|---|---|
23 | 23 |
|
24 | 24 |
// Create a field_collection field to use for the tests. |
25 | 25 |
$this->field_name = 'field_test_collection'; |
26 |
$this->field = array('field_name' => $this->field_name, 'type' => 'field_collection', 'cardinality' => 4); |
|
26 |
$this->field = array( |
|
27 |
'field_name' => $this->field_name, |
|
28 |
'type' => 'field_collection', |
|
29 |
'cardinality' => 4, |
|
30 |
); |
|
27 | 31 |
$this->field = field_create_field($this->field); |
28 | 32 |
$this->field_id = $this->field['id']; |
29 | 33 |
|
... | ... | |
83 | 87 |
* Message to display. |
84 | 88 |
* @param $group |
85 | 89 |
* The group this message belongs to, defaults to 'Other'. |
86 |
* @return |
|
90 |
* |
|
91 |
* @return bool |
|
87 | 92 |
* TRUE on pass, FALSE on fail. |
88 | 93 |
*/ |
89 | 94 |
protected function assertNoHookMessage($text, $message = NULL, $group = 'Other') { |
... | ... | |
282 | 287 |
$this->assertTrue($item->archived, 'Removed field collection item is archived.'); |
283 | 288 |
|
284 | 289 |
// Test removing an old node revision. Make sure that the field collection |
285 |
// is not removed |
|
290 |
// is not removed.
|
|
286 | 291 |
list ($node, $item) = $this->createNodeWithFieldCollection(); |
287 | 292 |
$node_vid = $node->vid; |
288 | 293 |
$node->revision = TRUE; |
... | ... | |
714 | 719 |
} |
715 | 720 |
|
716 | 721 |
/** |
717 |
* Install a specified language if it has not been already, otherwise make sure that the language is enabled. |
|
722 |
* Install a specified language if it has not been already, otherwise make |
|
723 |
* sure that the language is enabled. |
|
718 | 724 |
* |
719 |
* @param $langcode |
|
725 |
* @param string $langcode
|
|
720 | 726 |
* The language code to check. |
721 | 727 |
*/ |
722 | 728 |
function addLanguage($langcode) { |
... | ... | |
887 | 893 |
/** |
888 | 894 |
* Create a translation using the Entity Translation Form. |
889 | 895 |
* |
890 |
* @param $node |
|
896 |
* @param mixed $node
|
|
891 | 897 |
* Node of the basic page to create translation for. |
892 |
* @param $langcode |
|
898 |
* @param string $langcode
|
|
893 | 899 |
* The language code of the translation. |
894 |
* @param $source_langcode |
|
900 |
* @param string $source_langcode
|
|
895 | 901 |
* The original language code. |
896 | 902 |
*/ |
897 | 903 |
protected function createTranslationForm($node, $langcode, $source_langcode = 'en') { |
... | ... | |
947 | 953 |
* |
948 | 954 |
* @param mixed $node |
949 | 955 |
* The node to remove the translation from. |
950 |
* @param unknown $langcode
|
|
956 |
* @param string $langcode
|
|
951 | 957 |
* The language of the translation to remove. |
952 |
* @param unknown $source_langcode
|
|
958 |
* @param string $source_langcode
|
|
953 | 959 |
* The source language of the node. |
954 | 960 |
*/ |
955 | 961 |
protected function removeTranslationForm($node, $langcode, $source_langcode) { |
... | ... | |
981 | 987 |
/** |
982 | 988 |
* Creates a translation programmatically using Entity Translation. |
983 | 989 |
* |
984 |
* @param $node |
|
990 |
* @param mixed $node
|
|
985 | 991 |
* Node of the basic page to create translation for. |
986 |
* @param $langcode |
|
992 |
* @param string $langcode
|
|
987 | 993 |
* The language code of the translation. |
988 |
* @param $source_langcode |
|
989 |
* The source language code. |
|
990 | 994 |
*/ |
991 | 995 |
protected function createTranslation($node, $langcode) { |
992 | 996 |
$source_langcode = $node->language; |
... | ... | |
1023 | 1027 |
field_attach_update('node', $node); |
1024 | 1028 |
|
1025 | 1029 |
// Reload an return the node. |
1026 |
$node = node_load($node->nid, null, TRUE);
|
|
1030 |
$node = node_load($node->nid, NULL, TRUE);
|
|
1027 | 1031 |
return $node; |
1028 | 1032 |
} |
1029 | 1033 |
|
... | ... | |
1032 | 1036 |
* |
1033 | 1037 |
* @param mixed $node |
1034 | 1038 |
* The node to remove the translation from. |
1035 |
* @param unknown $langcode
|
|
1039 |
* @param string $langcode
|
|
1036 | 1040 |
* The language of the translation to remove. |
1037 | 1041 |
*/ |
1038 | 1042 |
protected function removeTranslation($node, $langcode) { |
... | ... | |
1044 | 1048 |
node_save($node); |
1045 | 1049 |
|
1046 | 1050 |
// Reload and return the node. |
1047 |
$node = node_load($node->nid, null, TRUE);
|
|
1051 |
$node = node_load($node->nid, NULL, TRUE);
|
|
1048 | 1052 |
|
1049 | 1053 |
return $node; |
1050 | 1054 |
} |
... | ... | |
1052 | 1056 |
/** |
1053 | 1057 |
* Creates a new revision of the node and checks the result. |
1054 | 1058 |
* |
1055 |
* @param $node |
|
1056 |
* @param $langcode |
|
1057 |
* @param $source_langcode |
|
1058 |
* @return |
|
1059 |
* @param mixed $node |
|
1060 |
* The node to remove the translation from. |
|
1061 |
* @param string $langcode |
|
1062 |
* The language of the translation to remove. |
|
1063 |
* @param string $source_langcode |
|
1064 |
* The source language of the node. |
|
1065 |
* |
|
1066 |
* @return mixed |
|
1059 | 1067 |
* The new revision of the node. |
1060 | 1068 |
*/ |
1061 | 1069 |
protected function createRevision($node, $langcode, $source_langcode) { |
... | ... | |
1089 | 1097 |
* The language to check. |
1090 | 1098 |
*/ |
1091 | 1099 |
protected function checkFieldCollectionContent($node, $langcode) { |
1092 |
switch($langcode) { |
|
1100 |
switch ($langcode) {
|
|
1093 | 1101 |
case 'en': |
1094 | 1102 |
$untrans_field = self::UNTRANS_FIELD_EN; |
1095 | 1103 |
$trans_field = self::TRANS_FIELD_EN; |
1096 | 1104 |
break; |
1105 |
|
|
1097 | 1106 |
case 'de': |
1098 | 1107 |
$untrans_field = self::UNTRANS_FIELD_DE; |
1099 | 1108 |
$trans_field = self::TRANS_FIELD_DE; |
Formats disponibles : Unified diff
Weekly update of contrib modules