Révision 30d5b9c5
Ajouté par Mathieu Schiano Di Schiabica il y a environ 8 ans
drupal7/modules/system/system.test | ||
---|---|---|
905 | 905 |
$result = variable_get('common_test_cron'); |
906 | 906 |
$this->assertEqual($result, 'success', 'Cron correctly handles exceptions thrown during hook_cron() invocations.'); |
907 | 907 |
} |
908 |
|
|
909 |
/** |
|
910 |
* Tests that hook_flush_caches() is not invoked on every single cron run. |
|
911 |
* |
|
912 |
* @see system_cron() |
|
913 |
*/ |
|
914 |
public function testCronCacheExpiration() { |
|
915 |
module_enable(array('system_cron_test')); |
|
916 |
variable_del('system_cron_test_flush_caches'); |
|
917 |
|
|
918 |
// Invoke cron the first time: hook_flush_caches() should be called and then |
|
919 |
// get cached. |
|
920 |
drupal_cron_run(); |
|
921 |
$this->assertEqual(variable_get('system_cron_test_flush_caches'), 1, 'hook_flush_caches() was invoked the first time.'); |
|
922 |
$cache = cache_get('system_cache_tables'); |
|
923 |
$this->assertEqual(empty($cache), FALSE, 'Cache is filled with cache table data.'); |
|
924 |
|
|
925 |
// Run cron again and ensure that hook_flush_caches() is not called. |
|
926 |
variable_del('system_cron_test_flush_caches'); |
|
927 |
drupal_cron_run(); |
|
928 |
$this->assertNull(variable_get('system_cron_test_flush_caches'), 'hook_flush_caches() was not invoked the second time.'); |
|
929 |
} |
|
930 |
|
|
908 | 931 |
} |
909 | 932 |
|
910 | 933 |
/** |
Formats disponibles : Unified diff
Update to 7.42