Révision ed9a13f1
Ajouté par Assos Assos il y a plus de 3 ans
drupal7/sites/all/modules/feeds/tests/feeds_mapper_link.test | ||
---|---|---|
24 | 24 |
*/ |
25 | 25 |
private $contentType; |
26 | 26 |
|
27 |
/** |
|
28 |
* {@inheritdoc} |
|
29 |
*/ |
|
27 | 30 |
public static function getInfo() { |
28 | 31 |
return array( |
29 | 32 |
'name' => 'Mapper: Link', |
... | ... | |
33 | 36 |
); |
34 | 37 |
} |
35 | 38 |
|
39 |
/** |
|
40 |
* {@inheritdoc} |
|
41 |
*/ |
|
36 | 42 |
public function setUp() { |
37 | 43 |
parent::setUp(array('link')); |
38 | 44 |
|
... | ... | |
59 | 65 |
), |
60 | 66 |
), |
61 | 67 |
'omega' => array( |
62 |
'type' => 'link_field', |
|
68 |
'type' => 'link_field',
|
|
63 | 69 |
'instance_settings' => array( |
64 | 70 |
'instance[settings][title]' => 'value', |
65 | 71 |
'instance[settings][title_value]' => $this->staticTitle, |
... | ... | |
73 | 79 |
*/ |
74 | 80 |
public function test() { |
75 | 81 |
// Create importer configuration. |
76 |
$this->createImporterConfiguration(); //Create a default importer configuration |
|
77 |
$this->setSettings('syndication', 'FeedsNodeProcessor', array('bundle' => $this->contentType)); //Processor settings |
|
82 |
// Create a default importer configuration. |
|
83 |
$this->createImporterConfiguration(); |
|
84 |
// Processor settings. |
|
85 |
$this->setSettings('syndication', 'FeedsNodeProcessor', array('bundle' => $this->contentType)); |
|
78 | 86 |
$this->addMappings('syndication', array( |
79 | 87 |
0 => array( |
80 | 88 |
'source' => 'title', |
81 |
'target' => 'title' |
|
89 |
'target' => 'title',
|
|
82 | 90 |
), |
83 | 91 |
1 => array( |
84 | 92 |
'source' => 'timestamp', |
85 |
'target' => 'created' |
|
93 |
'target' => 'created',
|
|
86 | 94 |
), |
87 | 95 |
2 => array( |
88 | 96 |
'source' => 'description', |
89 |
'target' => 'body' |
|
97 |
'target' => 'body',
|
|
90 | 98 |
), |
91 | 99 |
3 => array( |
92 | 100 |
'source' => 'url', |
93 |
'target' => 'field_alpha:url' |
|
101 |
'target' => 'field_alpha:url',
|
|
94 | 102 |
), |
95 | 103 |
4 => array( |
96 | 104 |
'source' => 'title', |
97 |
'target' => 'field_alpha:title' |
|
105 |
'target' => 'field_alpha:title',
|
|
98 | 106 |
), |
99 | 107 |
5 => array( |
100 | 108 |
'source' => 'url', |
101 |
'target' => 'field_beta:url' |
|
109 |
'target' => 'field_beta:url',
|
|
102 | 110 |
), |
103 | 111 |
6 => array( |
104 | 112 |
'source' => 'url', |
105 |
'target' => 'field_gamma:url' |
|
113 |
'target' => 'field_gamma:url',
|
|
106 | 114 |
), |
107 | 115 |
7 => array( |
108 | 116 |
'source' => 'title', |
109 |
'target' => 'field_gamma:title' |
|
117 |
'target' => 'field_gamma:title',
|
|
110 | 118 |
), |
111 | 119 |
8 => array( |
112 | 120 |
'source' => 'url', |
113 |
'target' => 'field_omega:url' |
|
121 |
'target' => 'field_omega:url',
|
|
114 | 122 |
), |
115 | 123 |
)); |
116 | 124 |
|
... | ... | |
125 | 133 |
$url = 'http://developmentseed.org/blog/2009/oct/06/open-atrium-translation-workflow-two-way-updating'; |
126 | 134 |
$title = 'Open Atrium Translation Workflow: Two Way Translation Updates'; |
127 | 135 |
$this->assertNodeFieldValue('alpha', array('url' => $url, 'static' => $title)); |
128 |
$this->assertNodeFieldValue('beta', array('url' => $url));
|
|
136 |
$this->assertNodeFieldValue('beta', array('url' => $url)); |
|
129 | 137 |
$this->assertNodeFieldValue('gamma', array('url' => $url, 'static' => $title)); |
130 | 138 |
$this->assertNodeFieldValue('omega', array('url' => $url, 'static' => $this->staticTitle)); |
131 | 139 |
|
... | ... | |
159 | 167 |
), |
160 | 168 |
1 => array( |
161 | 169 |
'source' => 'title', |
162 |
'target' => 'title' |
|
170 |
'target' => 'title',
|
|
163 | 171 |
), |
164 | 172 |
2 => array( |
165 | 173 |
'source' => 'url', |
166 |
'target' => 'field_alpha:url' |
|
174 |
'target' => 'field_alpha:url',
|
|
167 | 175 |
), |
168 | 176 |
3 => array( |
169 | 177 |
'source' => 'link_title', |
170 |
'target' => 'field_alpha:title' |
|
178 |
'target' => 'field_alpha:title',
|
|
171 | 179 |
), |
172 | 180 |
4 => array( |
173 | 181 |
'source' => 'url', |
174 |
'target' => 'field_beta:url' |
|
182 |
'target' => 'field_beta:url',
|
|
175 | 183 |
), |
176 | 184 |
5 => array( |
177 | 185 |
'source' => 'link_title', |
178 |
'target' => 'field_beta:title' |
|
186 |
'target' => 'field_beta:title',
|
|
179 | 187 |
), |
180 | 188 |
6 => array( |
181 | 189 |
'source' => 'url', |
182 |
'target' => 'field_gamma:url' |
|
190 |
'target' => 'field_gamma:url',
|
|
183 | 191 |
), |
184 | 192 |
7 => array( |
185 | 193 |
'source' => 'link_title', |
186 |
'target' => 'field_gamma:title' |
|
194 |
'target' => 'field_gamma:title',
|
|
187 | 195 |
), |
188 | 196 |
8 => array( |
189 | 197 |
'source' => 'url', |
190 |
'target' => 'field_omega:url' |
|
198 |
'target' => 'field_omega:url',
|
|
191 | 199 |
), |
192 | 200 |
9 => array( |
193 | 201 |
'source' => 'link_title', |
194 |
'target' => 'field_omega:title' |
|
202 |
'target' => 'field_omega:title',
|
|
195 | 203 |
), |
196 | 204 |
)); |
197 | 205 |
|
... | ... | |
316 | 324 |
$this->assertNoText($this->staticTitle, 'Static title link not found.'); |
317 | 325 |
} |
318 | 326 |
|
327 |
/** |
|
328 |
* Tests link field validation. |
|
329 |
*/ |
|
330 |
public function testLinkFieldValidation() { |
|
331 |
// Create and configure importer. |
|
332 |
$this->createImporterConfiguration('CSV', 'csv'); |
|
333 |
$this->setSettings('csv', NULL, array( |
|
334 |
'content_type' => '', |
|
335 |
'import_period' => FEEDS_SCHEDULE_NEVER, |
|
336 |
)); |
|
337 |
$this->setPlugin('csv', 'FeedsFileFetcher'); |
|
338 |
$this->setPlugin('csv', 'FeedsCSVParser'); |
|
339 |
$this->setSettings('csv', 'FeedsNodeProcessor', array( |
|
340 |
'bundle' => $this->contentType, |
|
341 |
)); |
|
342 |
$this->addMappings('csv', array( |
|
343 |
0 => array( |
|
344 |
'source' => 'title', |
|
345 |
'target' => 'title', |
|
346 |
), |
|
347 |
1 => array( |
|
348 |
'source' => 'alpha', |
|
349 |
'target' => 'field_alpha:title', |
|
350 |
), |
|
351 |
2 => array( |
|
352 |
'source' => 'alpha', |
|
353 |
'target' => 'field_alpha:url', |
|
354 |
), |
|
355 |
)); |
|
356 |
$this->importFile('csv', $this->absolutePath() . '/tests/feeds/content.csv'); |
|
357 |
$this->assertText('Failed importing 1 node.'); |
|
358 |
$this->assertText("Field validation errors in item 'Ut wisi enim ad minim veniam'"); |
|
359 |
$this->assertText('The value Ut wisi provided for alpha_link_field_label is not a valid URL.'); |
|
360 |
} |
|
361 |
|
|
319 | 362 |
/** |
320 | 363 |
* Override parent::getFormFieldsNames(). |
321 | 364 |
*/ |
Formats disponibles : Unified diff
Weekly update of contrib modules