public function ViewsExposedFormTest::testRemember in Views (for Drupal 7) 7.3
Tests that exposed values are correctly stored.
File
- tests/
views_exposed_form.test, line 69 - Definition of ViewsExposedFormTest.
Class
- ViewsExposedFormTest
- Tests exposed forms.
Code
public function testRemember() {
$account = $this
->drupalCreateUser();
$this
->drupalLogin($account);
// Create some random nodes.
for ($i = 0; $i < 5; $i++) {
$this
->drupalCreateNode();
}
// Set the exposed filter.
$this
->drupalGet('test_exposed_remember', array(
'query' => array(
'type' => 'page',
),
));
$this
->assertFieldByName('type', 'page');
// Request the page again, should still be set.
$this
->drupalGet('test_exposed_remember');
$this
->assertFieldByName('type', 'page');
// Request the page with an unrelated GET argument, filter should still be
// set.
$this
->drupalGet('test_exposed_remember', array(
'query' => array(
'argument' => 'value',
),
));
$this
->assertFieldByName('type', 'page');
// Change the remembered exposed value.
$this
->drupalGet('test_exposed_remember', array(
'query' => array(
'type' => 'article',
),
));
$this
->assertFieldByName('type', 'article');
// Request the page again, should have remembered the new value.
$this
->drupalGet('test_exposed_remember');
$this
->assertFieldByName('type', 'article');
}