Révision 6d8023f2
Ajouté par Assos Assos il y a plus de 5 ans
drupal7/sites/all/modules/taxonomy_menu/taxonomy_menu.test | ||
---|---|---|
1 | 1 |
<?php |
2 |
|
|
3 | 2 |
/** |
4 | 3 |
* @file |
5 | 4 |
* Tests for taxonomy_menu.module. |
... | ... | |
36 | 35 |
} |
37 | 36 |
|
38 | 37 |
/** |
39 |
* Get the first available text format |
|
38 |
* Get the first available text format.
|
|
40 | 39 |
*/ |
41 | 40 |
function getTextFormat() { |
42 | 41 |
static $format = NULL; |
... | ... | |
47 | 46 |
} |
48 | 47 |
|
49 | 48 |
/** |
50 |
* Create a new term record |
|
49 |
* Create a new term record.
|
|
51 | 50 |
*/ |
52 | 51 |
function createNewTerm($vocabulary, $name = NULL, $parent = NULL) { |
53 | 52 |
$term = new stdClass(); |
... | ... | |
139 | 138 |
} |
140 | 139 |
|
141 | 140 |
/** |
142 |
* Tests for features requiring a taxonomy hierarchy |
|
141 |
* Tests for features requiring a taxonomy hierarchy.
|
|
143 | 142 |
*/ |
144 | 143 |
class TaxonomyMenuHierarchyTest extends TaxonomyMenuWebTestCase { |
145 | 144 |
|
... | ... | |
185 | 184 |
|
186 | 185 |
$this->assertResponse(200); |
187 | 186 |
|
188 |
// By default, auto expand is on : we must find the whole hierarchy |
|
187 |
// By default, auto expand is on : we must find the whole hierarchy.
|
|
189 | 188 |
foreach ($this->terms as $term) { |
190 | 189 |
$this->assertLink($term->name); // 1st level |
191 | 190 |
foreach ($term->children as $child) { |
... | ... | |
197 | 196 |
} |
198 | 197 |
} |
199 | 198 |
|
200 |
// Set auto expand to off |
|
199 |
// Set auto expand to off.
|
|
201 | 200 |
$edit = array(); |
202 | 201 |
$edit['taxonomy_menu[options][expanded]'] = FALSE; |
203 |
//$edit['taxonomy_menu[options][rebuild]'] = '1'; // Rebuild menu on submit
|
|
202 |
// $edit['taxonomy_menu[options][rebuild]'] = '1'; // Rebuild menu on submit.
|
|
204 | 203 |
$this->drupalPost('admin/structure/taxonomy/' . $this->vocabulary->machine_name . '/edit', $edit, 'Save'); |
205 | 204 |
$this->assertResponse(200); |
206 |
//$this->drupalGet('admin/structure/taxonomy/'. $this->vocabulary->machine_name . '/edit'); |
|
205 |
// $this->drupalGet('admin/structure/taxonomy/'. $this->vocabulary->machine_name . '/edit');
|
|
207 | 206 |
|
208 |
// We should have links to the first level of the hierarchy only |
|
207 |
// We should have links to the first level of the hierarchy only.
|
|
209 | 208 |
$this->drupalGet('<front>'); |
210 | 209 |
foreach ($this->terms as $term) { |
211 | 210 |
$this->assertLink($term->name); |
... | ... | |
229 | 228 |
$this->assertNoLink($child->name); |
230 | 229 |
} |
231 | 230 |
else { |
232 |
// We must have a link AND the children |
|
231 |
// We must have a link AND the children.
|
|
233 | 232 |
$this->assertLink($child->name); |
234 | 233 |
if ($child->name == "term1_2") { |
235 | 234 |
foreach ($child->children as $grandchild) { |
... | ... | |
243 | 242 |
} |
244 | 243 |
|
245 | 244 |
/** |
246 |
* Helper class to build the tree and keep data on hand |
|
245 |
* Helper class to build the tree and keep data on hand.
|
|
247 | 246 |
*/ |
248 | 247 |
class TaxonomyMenuTreeNode { |
249 | 248 |
function __construct(&$testcase, $parent, $name, $children) { |
... | ... | |
267 | 266 |
} |
268 | 267 |
} |
269 | 268 |
} |
270 |
|
Formats disponibles : Unified diff
Weekly update of contrib modules