Révision c8740e19
Ajouté par Assos Assos il y a plus de 9 ans
drupal7/sites/all/modules/link/tests/link.attribute.test | ||
---|---|---|
46 | 46 |
protected function assertLinkOnNode($field_name, $link_value, $message = '', $group = 'Other') { |
47 | 47 |
$this->zebra++; |
48 | 48 |
$zebra_string = ($this->zebra % 2 == 0) ? 'even' : 'odd'; |
49 |
$cssFieldLocator = 'field-'. str_replace('_', '-', $field_name); |
|
50 |
$this->assertPattern('@<div class="field field-type-link '. $cssFieldLocator .'".*<div class="field-item '. $zebra_string .'">\s*'. $link_value .'\s*</div>@is',
|
|
49 |
$cssFieldLocator = 'field-' . str_replace('_', '-', $field_name);
|
|
50 |
$this->assertPattern('@<div class="field field-type-link ' . $cssFieldLocator . '".*<div class="field-item ' . $zebra_string . '">\s*' . $link_value . '\s*</div>@is',
|
|
51 | 51 |
$message, |
52 | 52 |
$group); |
53 | 53 |
} |
... | ... | |
66 | 66 |
// Create the content type. |
67 | 67 |
$this->clickLink(t('Add content type')); |
68 | 68 |
|
69 |
$edit = array (
|
|
69 |
$edit = array( |
|
70 | 70 |
'name' => $content_type_friendly, |
71 | 71 |
'type' => $content_type_machine, |
72 | 72 |
); |
... | ... | |
76 | 76 |
// Now add a singleton field. |
77 | 77 |
$single_field_name_friendly = $this->randomName(20); |
78 | 78 |
$single_field_name_machine = strtolower($this->randomName(10)); |
79 |
$single_field_name = 'field_'. $single_field_name_machine; |
|
80 |
$edit = array (
|
|
79 |
$single_field_name = 'field_' . $single_field_name_machine;
|
|
80 |
$edit = array( |
|
81 | 81 |
'fields[_add_new_field][label]' => $single_field_name_friendly, |
82 | 82 |
'fields[_add_new_field][field_name]' => $single_field_name_machine, |
83 | 83 |
'fields[_add_new_field][type]' => 'link_field', |
... | ... | |
112 | 112 |
$this->drupalLogin($this->web_user); |
113 | 113 |
|
114 | 114 |
// Go to page. |
115 |
$this->drupalGet('node/add/'. $content_type_machine); |
|
115 |
$this->drupalGet('node/add/' . $content_type_machine);
|
|
116 | 116 |
|
117 | 117 |
// Add a node. |
118 | 118 |
$edit = array( |
119 | 119 |
'title' => $title, |
120 |
'field_'. $single_field_name_machine. '[und][0][title]' => 'Link',
|
|
121 |
'field_'. $single_field_name_machine. '[und][0][url]' => 'http://www.drupal.org/',
|
|
120 |
'field_' . $single_field_name_machine . '[und][0][title]' => 'Link',
|
|
121 |
'field_' . $single_field_name_machine . '[und][0][url]' => 'http://www.drupal.org/',
|
|
122 | 122 |
); |
123 | 123 |
|
124 | 124 |
$this->drupalPost(NULL, $edit, t('Save')); |
125 | 125 |
$this->assertText(t('@content_type_friendly @title has been created', array('@content_type_friendly' => $content_type_friendly, '@title' => $title))); |
126 | 126 |
|
127 |
$this->drupalGet('node/add/'. $content_type_machine); |
|
127 |
$this->drupalGet('node/add/' . $content_type_machine);
|
|
128 | 128 |
|
129 | 129 |
// Create a node: |
130 | 130 |
$edit = array( |
... | ... | |
143 | 143 |
|
144 | 144 |
protected function createSimpleLinkField($single_field_name_machine, $single_field_name_friendly, $content_type_machine) { |
145 | 145 |
$this->drupalGet('admin/structure/types/manage/' . $content_type_machine . '/fields'); |
146 |
$edit = array (
|
|
146 |
$edit = array( |
|
147 | 147 |
'fields[_add_new_field][label]' => $single_field_name_friendly, |
148 | 148 |
'fields[_add_new_field][field_name]' => $single_field_name_machine, |
149 | 149 |
'fields[_add_new_field][type]' => 'link_field', |
... | ... | |
180 | 180 |
} |
181 | 181 |
|
182 | 182 |
protected function createNodeForTesting($content_type_machine, $content_type_friendly, $single_field_name_machine, $title, $url, $node_title = '') { |
183 |
$this->drupalGet('node/add/'. $content_type_machine); |
|
183 |
$this->drupalGet('node/add/' . $content_type_machine);
|
|
184 | 184 |
|
185 | 185 |
if (!$node_title) { |
186 | 186 |
$node_title = $this->randomName(20); |
... | ... | |
219 | 219 |
$this->createSimpleLinkField($single_field_name_machine, $single_field_name_friendly, $content_type_machine); |
220 | 220 |
|
221 | 221 |
// Okay, now we want to make sure this display is changed: |
222 |
$this->drupalGet('admin/structure/types/manage/'. $content_type_machine .'/display');
|
|
222 |
$this->drupalGet('admin/structure/types/manage/' . $content_type_machine . '/display');
|
|
223 | 223 |
$edit = array( |
224 |
'fields[field_'. $single_field_name_machine .'][label]' => 'above',
|
|
225 |
'fields[field_'. $single_field_name_machine .'][type]' => 'link_plain',
|
|
224 |
'fields[field_' . $single_field_name_machine . '][label]' => 'above',
|
|
225 |
'fields[field_' . $single_field_name_machine . '][type]' => 'link_plain',
|
|
226 | 226 |
); |
227 | 227 |
$this->drupalPost(NULL, $edit, t('Save')); |
228 | 228 |
|
... | ... | |
270 | 270 |
$this->createSimpleLinkField($single_field_name_machine, $single_field_name_friendly, $content_type_machine); |
271 | 271 |
|
272 | 272 |
// Okay, now we want to make sure this display is changed: |
273 |
$this->drupalGet('admin/structure/types/manage/'. $content_type_machine .'/display');
|
|
273 |
$this->drupalGet('admin/structure/types/manage/' . $content_type_machine . '/display');
|
|
274 | 274 |
$edit = array( |
275 |
'fields[field_'. $single_field_name_machine .'][label]' => 'above',
|
|
276 |
'fields[field_'. $single_field_name_machine .'][type]' => 'link_url',
|
|
275 |
'fields[field_' . $single_field_name_machine . '][label]' => 'above',
|
|
276 |
'fields[field_' . $single_field_name_machine . '][type]' => 'link_url',
|
|
277 | 277 |
); |
278 | 278 |
$this->drupalPost(NULL, $edit, t('Save')); |
279 | 279 |
|
... | ... | |
320 | 320 |
$this->createSimpleLinkField($single_field_name_machine, $single_field_name_friendly, $content_type_machine); |
321 | 321 |
|
322 | 322 |
// Okay, now we want to make sure this display is changed: |
323 |
$this->drupalGet('admin/structure/types/manage/'. $content_type_machine .'/display');
|
|
323 |
$this->drupalGet('admin/structure/types/manage/' . $content_type_machine . '/display');
|
|
324 | 324 |
$edit = array( |
325 |
'fields[field_'. $single_field_name_machine .'][label]' => 'above',
|
|
326 |
'fields[field_'. $single_field_name_machine .'][type]' => 'link_short',
|
|
325 |
'fields[field_' . $single_field_name_machine . '][label]' => 'above',
|
|
326 |
'fields[field_' . $single_field_name_machine . '][type]' => 'link_short',
|
|
327 | 327 |
); |
328 | 328 |
$this->drupalPost(NULL, $edit, t('Save')); |
329 | 329 |
|
... | ... | |
371 | 371 |
$this->createSimpleLinkField($single_field_name_machine, $single_field_name_friendly, $content_type_machine); |
372 | 372 |
|
373 | 373 |
// Okay, now we want to make sure this display is changed: |
374 |
$this->drupalGet('admin/structure/types/manage/'. $content_type_machine .'/display');
|
|
374 |
$this->drupalGet('admin/structure/types/manage/' . $content_type_machine . '/display');
|
|
375 | 375 |
$edit = array( |
376 |
'fields[field_'. $single_field_name_machine .'][label]' => 'above',
|
|
377 |
'fields[field_'. $single_field_name_machine .'][type]' => 'link_label',
|
|
376 |
'fields[field_' . $single_field_name_machine . '][label]' => 'above',
|
|
377 |
'fields[field_' . $single_field_name_machine . '][type]' => 'link_label',
|
|
378 | 378 |
); |
379 | 379 |
$this->drupalPost(NULL, $edit, t('Save')); |
380 | 380 |
|
... | ... | |
422 | 422 |
$this->createSimpleLinkField($single_field_name_machine, $single_field_name_friendly, $content_type_machine); |
423 | 423 |
|
424 | 424 |
// Okay, now we want to make sure this display is changed: |
425 |
$this->drupalGet('admin/structure/types/manage/'. $content_type_machine .'/display');
|
|
425 |
$this->drupalGet('admin/structure/types/manage/' . $content_type_machine . '/display');
|
|
426 | 426 |
$edit = array( |
427 |
'fields[field_'. $single_field_name_machine .'][label]' => 'above',
|
|
428 |
'fields[field_'. $single_field_name_machine .'][type]' => 'link_separate',
|
|
427 |
'fields[field_' . $single_field_name_machine . '][label]' => 'above',
|
|
428 |
'fields[field_' . $single_field_name_machine . '][type]' => 'link_separate',
|
|
429 | 429 |
); |
430 | 430 |
$this->drupalPost(NULL, $edit, t('Save')); |
431 | 431 |
|
... | ... | |
474 | 474 |
$this->createSimpleLinkField($single_field_name_machine, $single_field_name_friendly, $content_type_machine); |
475 | 475 |
|
476 | 476 |
// Okay, now we want to make sure this display is changed: |
477 |
$this->drupalGet('admin/structure/types/manage/'. $content_type_machine .'/display');
|
|
477 |
$this->drupalGet('admin/structure/types/manage/' . $content_type_machine . '/display');
|
|
478 | 478 |
$edit = array( |
479 |
'fields[field_'. $single_field_name_machine .'][label]' => 'above',
|
|
480 |
'fields[field_'. $single_field_name_machine .'][type]' => 'link_title_plain',
|
|
479 |
'fields[field_' . $single_field_name_machine . '][label]' => 'above',
|
|
480 |
'fields[field_' . $single_field_name_machine . '][type]' => 'link_title_plain',
|
|
481 | 481 |
); |
482 | 482 |
$this->drupalPost(NULL, $edit, t('Save')); |
483 | 483 |
|
Formats disponibles : Unified diff
Weekly update of contrib modules