updated core to 7.63

This commit is contained in:
2019-01-27 14:26:06 +01:00
parent ccab226e12
commit 31cfa90501
172 changed files with 2256 additions and 624 deletions

View File

@@ -1420,6 +1420,59 @@ class FormsFormStoragePageCacheTestCase extends DrupalWebTestCase {
}
}
/**
* Test cache_form.
*/
class FormsFormCacheTestCase extends DrupalWebTestCase {
public static function getInfo() {
return array(
'name' => 'Form caching',
'description' => 'Tests storage and retrieval of forms from cache.',
'group' => 'Form API',
);
}
function setUp() {
parent::setUp('form_test');
}
/**
* Tests storing and retrieving the form from cache.
*/
function testCacheForm() {
$form = drupal_get_form('form_test_cache_form');
$form_state = array('foo' => 'bar', 'build_info' => array('baz'));
form_set_cache($form['#build_id'], $form, $form_state);
$cached_form_state = array();
$cached_form = form_get_cache($form['#build_id'], $cached_form_state);
$this->assertEqual($cached_form['#build_id'], $form['#build_id'], 'Form retrieved from cache_form successfully.');
$this->assertEqual($cached_form_state['foo'], 'bar', 'Data retrieved from cache_form successfully.');
}
/**
* Tests changing form_cache_expiration.
*/
function testCacheFormCustomExpiration() {
variable_set('form_cache_expiration', -1 * (24 * 60 * 60));
$form = drupal_get_form('form_test_cache_form');
$form_state = array('foo' => 'bar', 'build_info' => array('baz'));
form_set_cache($form['#build_id'], $form, $form_state);
// Clear expired entries from cache_form, which should include the entry we
// just stored. Without this, the form will still be retrieved from cache.
cache_clear_all(NULL, 'cache_form');
$cached_form_state = array();
$cached_form = form_get_cache($form['#build_id'], $cached_form_state);
$this->assertNull($cached_form, 'Expired form was not returned from cache.');
$this->assertTrue(empty($cached_form_state), 'No data retrieved from cache for expired form.');
}
}
/**
* Test wrapper form callbacks.
*/