function PathRedirectFunctionalTest::testInactivePurging in Path redirect 6        
                          
                  
                        
File
 
   - ./path_redirect.test, line 223
- Tests for the path_redirect module.
Class
  
  - PathRedirectFunctionalTest 
Code
function testInactivePurging() {
  
  $time = time();
  $r1 = $this
    ->addRedirect('test1', 'node', array(
    'last_used' => $time - 620000,
  ));
  $r2 = $this
    ->addRedirect('test2', 'node', array(
    'last_used' => $time - 620000,
  ));
  
  $this
    ->cronRun();
  $this
    ->assertTrue(path_redirect_load($r1['rid']), t('Inactive redirect not removed.'));
  $this
    ->assertTrue(path_redirect_load($r2['rid']), t('Inactive redirect not removed.'));
  
  $edit = array(
    'path_redirect_purge_inactive' => 604800,
  );
  $this
    ->drupalPost('admin/build/path-redirect/settings', $edit, t('Save configuration'));
  $this
    ->assertText(t('The configuration options have been saved.'));
  
  $this
    ->drupalGet('test1');
  $this
    ->assertTrue(db_result(db_query("SELECT last_used FROM {path_redirect} WHERE source = 'test1'")) >= $time, t('Last used timestamp was updated.'));
  
  $this
    ->cronRun();
  $this
    ->assertTrue(path_redirect_load($r1['rid']), t('Active redirect not removed.'));
  $this
    ->assertFalse(path_redirect_load($r2['rid']), t('Inactive redirect removed.'));
}