function CacheActionsPanelsTestCase::testClearPanelVariants in Cache Actions 7
Same name and namespace in other branches
- 6.2 cache_actions.test \CacheActionsPanelsTestCase::testClearPanelVariants()
- 7.2 cache_actions.test \CacheActionsPanelsTestCase::testClearPanelVariants()
Test clearing panel page variants.
File
- ./
cache_actions.test, line 131 - This file contains the tests for Cache Actions. All tests depend on the panels, views and rules that are defined by the cache actions test module.
Class
- CacheActionsPanelsTestCase
- Tests for clearing panels.
Code
function testClearPanelVariants() {
// Needed in order to register the default panels.
drupal_flush_all_caches();
// Create a node.
$node = $this
->drupalCreateNode();
// Let's go to a panel, in order to make it cached.
$html = $this
->drupalGet('cache-actions-test-panel');
// We should be able to see the title
$this
->assertText($node->title);
// Get a panel that doesn't have a rule that will be triggered.
$html = $this
->drupalGet('cache-actions-test-panel-no-cache');
// We should be able to see the title
$this
->assertText($node->title);
// Alter the title.
$node->title = "Altered title";
node_save($node);
// The title should be correct in the first panel.
$html = $this
->drupalGet('cache-actions-test-panel');
// We should be able to see the title
$this
->assertText($node->title);
// And not be correct in the second.
$html = $this
->drupalGet('cache-actions-test-panel-no-cache');
$this
->assertNoText($node->title);
}