1 |
e5e66f93
|
Assos Assos
|
<?php
|
2 |
|
|
/**
|
3 |
|
|
* @file
|
4 |
|
|
* Test the node functionality for Panelizer.
|
5 |
|
|
*/
|
6 |
|
|
|
7 |
|
|
/**
|
8 |
|
|
* Verifies Panelizer configuration options for nodes.
|
9 |
|
|
*/
|
10 |
|
|
class PanelizerNodeTest extends PanelizerTestHelper {
|
11 |
|
|
|
12 |
|
|
/**
|
13 |
|
|
* {@inheritdoc}
|
14 |
|
|
*/
|
15 |
|
|
public static function getInfo() {
|
16 |
|
|
return array(
|
17 |
|
|
'name' => 'Panelizer node workflow (excluding IPE)',
|
18 |
|
|
'description' => 'Test entity bundle configuration settings, excluding IPE.',
|
19 |
|
|
'group' => 'Panelizer',
|
20 |
|
|
);
|
21 |
|
|
}
|
22 |
|
|
|
23 |
|
|
/**
|
24 |
|
|
* {@inheritdoc}
|
25 |
|
|
*/
|
26 |
|
|
function setUp(array $modules = array()) {
|
27 |
|
|
parent::setUp();
|
28 |
|
|
|
29 |
|
|
$perms = array(
|
30 |
|
|
'create page content',
|
31 |
|
|
'administer content types',
|
32 |
|
|
'administer nodes',
|
33 |
|
|
'bypass node access',
|
34 |
|
|
'administer panelizer',
|
35 |
|
|
'administer page manager',
|
36 |
|
|
'use page manager',
|
37 |
|
|
);
|
38 |
|
|
$web_user = $this->drupalCreateUser($perms);
|
39 |
|
|
$this->drupalLogin($web_user);
|
40 |
|
|
}
|
41 |
|
|
|
42 |
|
|
/**
|
43 |
|
|
* Verify that the "Basic page" content type can be panelized.
|
44 |
|
|
*/
|
45 |
|
|
function testPageConfiguration() {
|
46 |
|
|
$content_type = 'page';
|
47 |
|
|
$view_mode = 'default';
|
48 |
|
|
|
49 |
|
|
// Panelize "Basic page" content type.
|
50 |
|
|
$edit = array(
|
51 |
|
|
'panelizer[status]' => TRUE,
|
52 |
|
|
);
|
53 |
|
|
$this->drupalPost('admin/structure/types/manage/' . $content_type, $edit, t('Save content type'));
|
54 |
|
|
|
55 |
|
|
// Create a test node.
|
56 |
|
|
$node = $this->createNode();
|
57 |
|
|
|
58 |
|
|
// Check that the post has been panelized.
|
59 |
|
|
$this->drupalGet('node/' . $node->nid);
|
60 |
|
|
$this->assertLink('Customize display', 0, 'The customize display link appears on the page');
|
61 |
|
|
$this->assertLinkByHref('node/' . $node->nid . '/panelizer', 0, 'A link to customize the node appears on the page');
|
62 |
|
|
|
63 |
|
|
// Allow panelization of the "Default" view mode.
|
64 |
|
|
$this->drupalGet('admin/structure/types/manage/' . $content_type);
|
65 |
|
|
$this->assertResponse(200);
|
66 |
|
|
$edit = array(
|
67 |
|
|
'panelizer[view modes][' . $view_mode . '][status]' => TRUE,
|
68 |
|
|
);
|
69 |
|
|
$this->drupalPost(NULL, $edit, t('Save content type'));
|
70 |
|
|
|
71 |
|
|
// Confirm the behavior of Panelizer when there is no default display
|
72 |
|
|
// available.
|
73 |
|
|
$paths = array(
|
74 |
|
|
$view_mode,
|
75 |
|
|
$view_mode . '/settings',
|
76 |
|
|
$view_mode . '/context',
|
77 |
|
|
$view_mode . '/layout',
|
78 |
|
|
$view_mode . '/content',
|
79 |
|
|
);
|
80 |
|
|
foreach ($paths as $path) {
|
81 |
|
|
$this->drupalGet('admin/structure/types/manage/' . $content_type . '/panelizer/' . $path);
|
82 |
|
|
$this->assertResponse(200);
|
83 |
|
|
$this->assertText(t('No default display has been configured for this view mode.'));
|
84 |
|
|
}
|
85 |
|
|
|
86 |
|
|
// Check that the view mode can be panelized.
|
87 |
|
|
$this->drupalGet('node/' . $node->nid . '/panelizer');
|
88 |
|
|
$this->assertText('Default');
|
89 |
|
|
$this->assertLink('panelize', 0, 'The panelize link for the view mode appears on the page');
|
90 |
|
|
$this->assertLinkByHref('node/' . $node->nid . '/panelizer/' . $view_mode, 0, 'A link to panelize the view mode appears on the page');
|
91 |
|
|
|
92 |
|
|
// Verify that the view mode is not currently panelized.
|
93 |
|
|
$this->drupalGet('node/' . $node->nid . '/panelizer/' . $view_mode);
|
94 |
|
|
$this->assertRaw(t('This %entity is not currently panelized.', array('%entity' => 'Node')));
|
95 |
|
|
|
96 |
|
|
// Panelize the view mode.
|
97 |
|
|
$this->drupalPost(NULL, array(), t('Panelize it!'));
|
98 |
|
|
|
99 |
|
|
// Check that the view mode has been panelized.
|
100 |
|
|
$this->drupalGet('node/' . $node->nid);
|
101 |
|
|
$elements = $this->xpath('//div[contains(@class,:class)]', array(':class' => 'panelizer-view-mode'));
|
102 |
|
|
$this->assertEqual(count($elements), 1, 'The node is panelized.');
|
103 |
|
|
}
|
104 |
|
|
|
105 |
|
|
/**
|
106 |
|
|
* Verify that multiple displays work.
|
107 |
|
|
*/
|
108 |
|
|
function testPageMultipleDisplays() {
|
109 |
|
|
// Panelize "Basic page" content type.
|
110 |
|
|
$content_type = 'page';
|
111 |
|
|
$view_mode = 'page_manager';
|
112 |
|
|
|
113 |
|
|
// Ensure node_view panel page is enabled for full page override to work.
|
114 |
|
|
$this->simpleEnablePage('node_view');
|
115 |
|
|
|
116 |
|
|
$edit = array(
|
117 |
|
|
'panelizer[status]' => TRUE,
|
118 |
|
|
// Enable the 'Full page override' view mode, which is managed by Page
|
119 |
|
|
// Manager.
|
120 |
|
|
'panelizer[view modes][' . $view_mode . '][status]' => TRUE,
|
121 |
|
|
// Provide a default display.
|
122 |
|
|
'panelizer[view modes][' . $view_mode . '][default]' => TRUE,
|
123 |
|
|
// Allow a specific display to be selected per node.
|
124 |
|
|
'panelizer[view modes][' . $view_mode . '][choice]' => TRUE,
|
125 |
|
|
);
|
126 |
|
|
$this->drupalPost('admin/structure/types/manage/' . $content_type, $edit, t('Save content type'));
|
127 |
|
|
$this->assertResponse(200);
|
128 |
|
|
|
129 |
|
|
// Verify the admin UI works.
|
130 |
|
|
$this->drupalGet('admin/structure/types/manage/' . $content_type . '/panelizer/' . $view_mode);
|
131 |
|
|
$this->assertResponse(200);
|
132 |
|
|
// Confirm the default display was added.
|
133 |
|
|
$this->assertText('node:page:default');
|
134 |
|
|
|
135 |
|
|
// Clone the display.
|
136 |
|
|
$this->drupalGet('admin/structure/types/manage/' . $content_type . '/panelizer/' . $view_mode . '/node:' . $content_type . ':default/clone');
|
137 |
|
|
$this->assertResponse(200);
|
138 |
|
|
$this->assertText(t('Name'));
|
139 |
|
|
$this->assertFieldById('edit-title', "Clone of Default", "Administrative Title");
|
140 |
|
|
|
141 |
|
|
// Manually set the machine name here as it's normally set by
|
142 |
|
|
// machine-name.js, which doesn't work via SimpleTest.
|
143 |
|
|
$this->drupalPost(NULL, array('name' => 'clone_of_default'), t('Save'));
|
144 |
|
|
$this->assertResponse(200);
|
145 |
|
|
$this->assertText(t('!item has been created.', array('!item' => 'node:' . $content_type . ':clone_of_default')));
|
146 |
|
|
|
147 |
|
|
// Verity the tabs are present on the form.
|
148 |
|
|
$this->assertLink('Settings');
|
149 |
|
|
$this->assertLink('Context');
|
150 |
|
|
$this->assertLink('Access');
|
151 |
|
|
$this->assertLink('Layout');
|
152 |
|
|
$this->assertLink('Content');
|
153 |
|
|
$this->assertLink('Export');
|
154 |
|
|
|
155 |
|
|
// Confirm the options show up on the node form.
|
156 |
|
|
$this->drupalGet('node/add/' . $content_type);
|
157 |
|
|
$this->assertField('panelizer[' . $view_mode . '][name]');
|
158 |
|
|
|
159 |
|
|
// Create a node with cloned display mode.
|
160 |
|
|
$args = array(
|
161 |
|
|
'panelizer[' . $view_mode . '][name]' => 'node:' . $content_type . ':clone_of_default',
|
162 |
|
|
);
|
163 |
|
|
$node = $this->createNode($args);
|
164 |
|
|
|
165 |
|
|
// Check that the post has been panelized.
|
166 |
|
|
$this->drupalGet('node/' . $node->nid);
|
167 |
|
|
$this->assertLink('Customize display', 0, 'The customize display link appears on the page');
|
168 |
|
|
$this->assertLinkByHref('node/' . $node->nid . '/panelizer', 0, 'A link to customize the node appears on the page');
|
169 |
|
|
|
170 |
|
|
// Check that the view mode can be panelized.
|
171 |
|
|
$this->drupalGet('node/' . $node->nid . '/panelizer');
|
172 |
|
|
$this->assertResponse(200);
|
173 |
|
|
$this->assertLink(t('Full page override'), 0, 'The panelize link for the "Full page override" view mode appears on the page');
|
174 |
|
|
$this->assertLinkByHref('node/' . $node->nid . '/panelizer/' . $view_mode, 0, 'A link to panelize the "Full page override" view mode appears on the page');
|
175 |
|
|
$this->assertNoLink(t('reset'), 0, 'The current display cannot be reset, it is default');
|
176 |
|
|
$this->assertText(t('Clone of Default'), 0, 'The current selected display is "Clone of Default"');
|
177 |
|
|
|
178 |
|
|
// Verify that the view mode is not currently panelized.
|
179 |
|
|
$this->drupalGet('node/' . $node->nid . '/panelizer/' . $view_mode);
|
180 |
|
|
$this->assertResponse(200);
|
181 |
|
|
|
182 |
|
|
// Panelize this view mode.
|
183 |
|
|
$this->drupalPost(NULL, array(), t('Save'));
|
184 |
|
|
$this->assertResponse(200);
|
185 |
|
|
|
186 |
|
|
// Check that the view mode has been panelized.
|
187 |
|
|
$this->drupalGet('node/' . $node->nid . '/panelizer');
|
188 |
|
|
$this->assertResponse(200);
|
189 |
|
|
$this->assertLink(t('reset'), 0, 'The current panelizer state can be reset');
|
190 |
|
|
$this->assertText(t('Custom'), 0, 'The current panelizer state of this node is "Custom"');
|
191 |
|
|
|
192 |
|
|
// Add a custom class to the original display.
|
193 |
|
|
$panelizer_name = 'node:' . $content_type . ':default';
|
194 |
|
|
$this->drupalGet("admin/structure/types/manage/{$content_type}/panelizer/{$view_mode}/{$panelizer_name}/settings");
|
195 |
|
|
$edit = array(
|
196 |
|
|
'css_class' => 'panelizer-original',
|
197 |
|
|
);
|
198 |
|
|
$this->drupalPost(NULL, $edit, t('Save'));
|
199 |
|
|
|
200 |
|
|
// Add a custom class to the cloned display.
|
201 |
|
|
$panelizer_name = 'node:' . $content_type . ':clone_of_default';
|
202 |
|
|
$this->drupalGet("admin/structure/types/manage/{$content_type}/panelizer/{$view_mode}/{$panelizer_name}/settings");
|
203 |
|
|
$edit = array(
|
204 |
|
|
'css_class' => 'panelizer-clone',
|
205 |
|
|
);
|
206 |
|
|
$this->drupalPost(NULL, $edit, t('Save'));
|
207 |
|
|
|
208 |
|
|
// Create a new test node.
|
209 |
|
|
$node = $this->createNode();
|
210 |
|
|
|
211 |
|
|
// Load the node page.
|
212 |
|
|
$this->drupalGet('node/' . $node->nid);
|
213 |
|
|
$this->assertResponse(200);
|
214 |
|
|
$elements = $this->xpath('//body[contains(@class,:class)]', array(':class' => 'panelizer-original'));
|
215 |
|
|
$this->assertEqual(count($elements), 1, "The node is using the original display.");
|
216 |
|
|
|
217 |
|
|
// Update the node to use the cloned display.
|
218 |
|
|
$this->drupalGet('node/' . $node->nid . '/edit');
|
219 |
|
|
$this->assertResponse(200);
|
220 |
|
|
$edit = array(
|
221 |
|
|
'panelizer[' . $view_mode . '][name]' => 'node:' . $content_type . ':clone_of_default',
|
222 |
|
|
);
|
223 |
|
|
$this->drupalPost(NULL, $edit, t('Save'));
|
224 |
|
|
$this->assertResponse(200);
|
225 |
|
|
$elements = $this->xpath('//body[contains(@class,:class)]', array(':class' => 'panelizer-clone'));
|
226 |
|
|
$this->assertEqual(count($elements), 1, "The node is using the cloned display.");
|
227 |
|
|
|
228 |
|
|
// Update the node again to use the original display.
|
229 |
|
|
$this->drupalGet('node/' . $node->nid . '/edit');
|
230 |
|
|
$this->assertResponse(200);
|
231 |
|
|
$edit = array(
|
232 |
|
|
'panelizer[' . $view_mode . '][name]' => 'node:' . $content_type . ':default',
|
233 |
|
|
);
|
234 |
|
|
$this->drupalPost(NULL, $edit, t('Save'));
|
235 |
|
|
$this->assertResponse(200);
|
236 |
|
|
$elements = $this->xpath('//body[contains(@class,:class)]', array(':class' => 'panelizer-original'));
|
237 |
|
|
$this->assertEqual(count($elements), 1, "The node is using the original display again.");
|
238 |
|
|
}
|
239 |
|
|
|
240 |
|
|
/**
|
241 |
|
|
* Make sure that cloning a default display works correctly.
|
242 |
|
|
*/
|
243 |
|
|
function testCloningDefaults() {
|
244 |
|
|
$content_type = 'page';
|
245 |
|
|
$view_mode = 'page_manager';
|
246 |
|
|
$original = "node:{$content_type}:default";
|
247 |
|
|
$clone = "node:{$content_type}:clone_of_default";
|
248 |
|
|
|
249 |
|
|
// Enable the node_view display in Page Manager.
|
250 |
|
|
$this->simpleEnablePage('node_view');
|
251 |
|
|
|
252 |
|
|
// Check the Page Manager admin page.
|
253 |
|
|
$this->drupalGet('admin/structure/pages');
|
254 |
|
|
$this->assertResponse(200);
|
255 |
|
|
$this->assertLink(t('Disable'));
|
256 |
|
|
|
257 |
|
|
// Panelize the content type and the view mode, give it a default display
|
258 |
|
|
// and allow multiple displays.
|
259 |
|
|
$edit = array();
|
260 |
|
|
$edit['panelizer[status]'] = TRUE;
|
261 |
|
|
$edit["panelizer[view modes][{$view_mode}][status]"] = TRUE;
|
262 |
|
|
$edit["panelizer[view modes][{$view_mode}][default]"] = TRUE;
|
263 |
|
|
$edit["panelizer[view modes][{$view_mode}][choice]"] = TRUE;
|
264 |
|
|
$this->drupalPost('admin/structure/types/manage/' . $content_type, $edit, t('Save content type'));
|
265 |
|
|
$this->assertResponse(200);
|
266 |
|
|
|
267 |
|
|
// Add a custom class to the default display. Without making this change the
|
268 |
|
|
// display won't be available via the CTools exports system.
|
269 |
|
|
$this->drupalGet("admin/structure/types/manage/{$content_type}/panelizer/{$view_mode}/{$original}/settings");
|
270 |
|
|
$edit = array(
|
271 |
|
|
'css_class' => 'panelizer-default',
|
272 |
|
|
);
|
273 |
|
|
$this->drupalPost(NULL, $edit, t('Save'));
|
274 |
|
|
|
275 |
|
|
// Clone the default display.
|
276 |
|
|
$this->drupalGet("admin/structure/types/manage/{$content_type}/panelizer/{$view_mode}/{$original}/clone");
|
277 |
|
|
$this->assertResponse(200);
|
278 |
|
|
$this->assertText(t('Name'));
|
279 |
|
|
$this->assertFieldById('edit-title', "Clone of Default", "Administrative Title");
|
280 |
|
|
// Manually set the machine name here as it's normally set by
|
281 |
|
|
// machine-name.js, which doesn't work via SimpleTest.
|
282 |
|
|
$this->drupalPost(NULL, array('name' => 'clone_of_default'), t('Save'));
|
283 |
|
|
$this->assertResponse(200);
|
284 |
|
|
// Confirm the status message.
|
285 |
|
|
$this->assertText(t('!item has been created.', array('!item' => $clone)));
|
286 |
|
|
|
287 |
|
|
// Load the two default displays.
|
288 |
|
|
$default_names = array(
|
289 |
|
|
$original => $original,
|
290 |
|
|
$clone => $clone,
|
291 |
|
|
);
|
292 |
|
|
$defaults = ctools_export_load_object('panelizer_defaults', 'names', $default_names);
|
293 |
|
|
$this->verbose('<pre>' . print_r($defaults, TRUE) . '</pre>');
|
294 |
|
|
|
295 |
|
|
// Compare the displays.
|
296 |
|
|
$this->compareDisplayPanes($defaults[$original], $defaults[$clone]);
|
297 |
|
|
}
|
298 |
|
|
|
299 |
|
|
/**
|
300 |
|
|
* Confirm that overriding a default display works correctly.
|
301 |
|
|
*/
|
302 |
|
|
function testNodeCustomDisplay() {
|
303 |
|
|
// Panelize "Basic page" content type.
|
304 |
|
|
$content_type = 'page';
|
305 |
|
|
$view_mode = 'page_manager';
|
306 |
|
|
$panelizer_name = "node:{$content_type}:default";
|
307 |
|
|
|
308 |
|
|
// Ensure node_view panel page is enabled for full page override to work.
|
309 |
|
|
$this->simpleEnablePage('node_view');
|
310 |
|
|
|
311 |
|
|
$edit = array(
|
312 |
|
|
'panelizer[status]' => TRUE,
|
313 |
|
|
// Enable the 'Full page override' view mode, which is managed by Page
|
314 |
|
|
// Manager.
|
315 |
|
|
'panelizer[view modes][' . $view_mode . '][status]' => TRUE,
|
316 |
|
|
// Provide a default display.
|
317 |
|
|
'panelizer[view modes][' . $view_mode . '][default]' => TRUE,
|
318 |
|
|
// Allow a specific display to be selected per node.
|
319 |
|
|
'panelizer[view modes][' . $view_mode . '][choice]' => TRUE,
|
320 |
|
|
);
|
321 |
|
|
$this->drupalPost('admin/structure/types/manage/' . $content_type, $edit, t('Save content type'));
|
322 |
|
|
$this->assertResponse(200);
|
323 |
|
|
|
324 |
|
|
// Add a custom class to the default display. Without making this change the
|
325 |
|
|
// display won't be available via the CTools exports system.
|
326 |
|
|
$this->drupalGet("admin/structure/types/manage/{$content_type}/panelizer/{$view_mode}/{$panelizer_name}/settings");
|
327 |
|
|
$edit = array(
|
328 |
|
|
'css_class' => 'panelizer-default',
|
329 |
|
|
);
|
330 |
|
|
$this->drupalPost(NULL, $edit, t('Save'));
|
331 |
|
|
|
332 |
|
|
// Create a test node.
|
333 |
|
|
$node = $this->createNode();
|
334 |
|
|
|
335 |
|
|
// Load the node page.
|
336 |
|
|
$this->drupalGet('node/' . $node->nid);
|
337 |
|
|
|
338 |
|
|
// Check that the new revision is rendered using the cloned display.
|
339 |
|
|
$elements = $this->xpath('//body[contains(@class,:class)]', array(':class' => 'panelizer-default'));
|
340 |
|
|
$this->assertEqual(count($elements), 1, 'The node is using the default display.');
|
341 |
|
|
|
342 |
|
|
// Check that the post has been panelized.
|
343 |
|
|
$this->drupalGet('node/' . $node->nid . '/panelizer/' . $view_mode . '/settings');
|
344 |
|
|
$this->assertResponse(200);
|
345 |
|
|
|
346 |
|
|
// Add a CSS class to the display.
|
347 |
|
|
$this->assertFieldByName('css_class');
|
348 |
|
|
$args = array(
|
349 |
|
|
'css_class' => 'panelizer-test',
|
350 |
|
|
);
|
351 |
|
|
$this->drupalPost(NULL, $args, t('Save'));
|
352 |
|
|
|
353 |
|
|
$this->drupalGet('node/' . $node->nid);
|
354 |
|
|
$elements = $this->xpath('//body[contains(@class,:class)]', array(':class' => 'panelizer-test'));
|
355 |
|
|
$this->assertEqual(count($elements), 1, 'The node is using the overridden display.');
|
356 |
|
|
|
357 |
|
|
// Confirm one more {panelizer_entity} record was added.
|
358 |
|
|
$records = $this->getPanelizerEntityRecords('node', $node->nid);
|
359 |
|
|
$this->assertTrue(count($records));
|
360 |
|
|
$pe = $records[0];
|
361 |
|
|
|
362 |
|
|
// Load the default display object.
|
363 |
|
|
$defaults = ctools_export_load_object('panelizer_defaults', 'names', array($panelizer_name => $panelizer_name));
|
364 |
|
|
$default_display = $defaults[$panelizer_name];
|
365 |
|
|
$this->verbose('<pre>' . print_r($default_display, TRUE) . '</pre>');
|
366 |
|
|
|
367 |
|
|
// Load the overridden display.
|
368 |
|
|
$displays = panels_load_displays(array($pe->did));
|
369 |
|
|
$this->verbose('<pre>' . print_r($displays, TRUE) . '</pre>');
|
370 |
|
|
$pe->display = $displays[$pe->did];
|
371 |
|
|
|
372 |
|
|
// Compare the two displays.
|
373 |
|
|
$this->compareDisplayPanes($default_display, $pe);
|
374 |
|
|
}
|
375 |
|
|
|
376 |
|
|
/**
|
377 |
|
|
* Confirm that view mode reassignment works correctly.
|
378 |
|
|
*/
|
379 |
|
|
function testViewModeReassignment() {
|
380 |
|
|
$entity_type = 'node';
|
381 |
|
|
$content_type = 'page';
|
382 |
|
|
$view_mode = 'teaser';
|
383 |
|
|
$css_class = 'panelizer-' . $view_mode;
|
384 |
|
|
$panelizer_name = "node:{$content_type}:default:{$view_mode}";
|
385 |
|
|
|
386 |
|
|
// Enable the Panels view mode too.
|
387 |
|
|
$this->simpleEnablePage('node_view');
|
388 |
|
|
|
389 |
|
|
// Enable Panelizer for the 'page' content type for view mode.
|
390 |
|
|
$this->togglePanelizer($entity_type, $content_type, $view_mode);
|
391 |
|
|
|
392 |
|
|
// Add a custom class to the default display.
|
393 |
|
|
$this->drupalGet("admin/structure/types/manage/{$content_type}/panelizer/{$view_mode}/{$panelizer_name}/settings");
|
394 |
|
|
$edit = array(
|
395 |
|
|
'css_class' => $css_class,
|
396 |
|
|
);
|
397 |
|
|
$this->drupalPost(NULL, $edit, t('Save'));
|
398 |
|
|
|
399 |
|
|
// Create a node, confirm that it doesn't have the class.
|
400 |
|
|
$node = $this->createNode();
|
401 |
|
|
$this->drupalGet('node/' . $node->nid);
|
402 |
|
|
$this->assertResponse(200);
|
403 |
|
|
$elements = $this->xpath('//body[contains(@class,:class)]', array(':class' => $css_class));
|
404 |
|
|
$this->assertEqual(count($elements), 0, "The node is not using the teaser view mode's display.");
|
405 |
|
|
|
406 |
|
|
// Enable Panelizer for the Full Page Override (i.e. Page Manager) view mode
|
407 |
|
|
// but make it use the Teaser view mode's display.
|
408 |
|
|
$this->drupalGet('admin/structure/types/manage/' . $content_type);
|
409 |
|
|
$this->assertResponse(200);
|
410 |
|
|
$edit = array(
|
411 |
|
|
'panelizer[view modes][page_manager][status]' => TRUE,
|
412 |
|
|
'panelizer[view modes][page_manager][substitute]' => $view_mode,
|
413 |
|
|
'panelizer[view modes][page_manager][default]' => 0,
|
414 |
|
|
'panelizer[view modes][page_manager][choice]' => 0,
|
415 |
|
|
);
|
416 |
|
|
$this->drupalPost(NULL, $edit, t('Save content type'));
|
417 |
|
|
|
418 |
|
|
// Load these two pages for testing purposes, just to see the configuration.
|
419 |
|
|
$this->drupalGet('admin/structure/types/manage/' . $content_type);
|
420 |
|
|
$this->drupalGet('node/' . $node->nid . '/panelizer');
|
421 |
|
|
|
422 |
|
|
// Load the node page again, confirm that the Teaser view mode is now being
|
423 |
|
|
// used.
|
424 |
|
|
$this->drupalGet('node/' . $node->nid);
|
425 |
|
|
$this->assertResponse(200);
|
426 |
|
|
$elements = $this->xpath('//body[contains(@class,:class)]', array(':class' => $css_class));
|
427 |
|
|
$this->assertEqual(count($elements), 1, "The node is now using the teaser view mode's display.");
|
428 |
|
|
}
|
429 |
|
|
|
430 |
|
|
} |