Changeset 1682

Show
Ignore:
Timestamp:
03/05/10 10:28:11 (5 months ago)
Author:
klemens
Message:

Fixed tests

Location:
trunk
Files:
5 modified

Legend:

Unmodified
Added
Removed
  • trunk/plugins/ullCorePlugin/lib/task/UserDeactivationTask.class.php

    r1680 r1682  
    2626  protected function execute($arguments = array(), $options = array()) 
    2727  { 
     28    // Delegated to a public method to allow testing 
     29    $this->deactivateUsers($arguments, $options); 
     30  } 
     31   
     32   
     33  public function deactivateUsers($arguments = array(), $options = array()) 
     34  { 
    2835    $this->initializeDatabaseConnection($arguments, $options); 
    2936     
     
    3138     
    3239    $q 
    33       ->update('UllUser u') 
    34       ->set('u.ull_user_status_id', '?', Doctrine::getTable('UllUserStatus')->findOneBySlug('inactive')->id) 
     40      ->from('UllUser u') 
    3541      ->where('u.deactivation_date <= ?', date('Y-m-d')) 
    3642      ->orWhere('u.separation_date <= ?', date('Y-m-d')) 
     
    3844    ; 
    3945     
    40     $num = $q->execute(); 
     46    $users = $q->execute(); 
    4147     
    42     $this->log("Deactivated {$num} users"); 
     48    $this->logSection($this->name, 'Deactivating ' . count($users) . ' users'); 
     49     
     50    foreach ($users as $user) 
     51    { 
     52      $this->log('Deactivating '. $user->display_name); 
     53      $user['ull_user_status_id'] = Doctrine::getTable('UllUserStatus')->findOneBySlug('inactive')->id; 
     54      $user->save(); 
     55    }     
    4356  } 
    4457   
  • trunk/test/functional/frontend/ullCorePlugin/ullUserSearchBasicTest.php

    r1496 r1682  
    6767    ->isParameter('action', 'list') 
    6868  ->end() 
     69   
     70  // redirect to edit if single result 
     71  ->with('response')->begin() 
     72    ->isRedirected() 
     73    ->isStatusCode(302) 
     74  ->end() 
     75  ->followRedirect() 
     76  ->with('request')->begin() 
     77    ->isParameter('module', 'ullUser') 
     78    ->isParameter('action', 'edit') 
     79  ->end() 
     80  ->with('response')->begin() 
     81    ->isStatusCode(200) 
     82  ->end() 
     83  ->click('Result list') 
     84   
     85  ->with('request')->begin() 
     86    ->isParameter('module', 'ullUser') 
     87    ->isParameter('action', 'list') 
     88  ->end()   
    6989  ->with('response')->begin() 
    7090    ->isStatusCode(200) 
     
    130150 
    131151$browser 
     152  ->with('request')->begin() 
     153    ->isParameter('module', 'ullUser') 
     154    ->isParameter('action', 'list') 
     155  ->end() 
     156   
     157  // redirect to edit if single result 
     158  ->with('response')->begin() 
     159    ->isRedirected() 
     160    ->isStatusCode(302) 
     161  ->end() 
     162  ->followRedirect() 
     163  ->with('request')->begin() 
     164    ->isParameter('module', 'ullUser') 
     165    ->isParameter('action', 'edit') 
     166  ->end() 
     167  ->with('response')->begin() 
     168    ->isStatusCode(200) 
     169  ->end() 
     170  ->click('Result list')   
     171   
    132172  ->with('request')->begin() 
    133173    ->isParameter('module', 'ullUser') 
  • trunk/test/functional/frontend/ullCorePlugin/ullUserSearchRangeTest.php

    r1561 r1682  
    190190    ->isParameter('action', 'list') 
    191191  ->end() 
     192   
     193  // redirect to edit if single result 
     194  ->with('response')->begin() 
     195    ->isRedirected() 
     196    ->isStatusCode(302) 
     197  ->end() 
     198  ->followRedirect() 
     199  ->with('request')->begin() 
     200    ->isParameter('module', 'ullUser') 
     201    ->isParameter('action', 'edit') 
     202  ->end() 
     203  ->with('response')->begin() 
     204    ->isStatusCode(200) 
     205  ->end() 
     206  ->click('Result list')   
     207   
     208  ->with('request')->begin() 
     209    ->isParameter('module', 'ullUser') 
     210    ->isParameter('action', 'list') 
     211  ->end()     
    192212  ->with('response')->begin() 
    193213    ->isStatusCode(200) 
     
    244264    ->isParameter('action', 'list') 
    245265  ->end() 
     266   
     267  // redirect to edit if single result 
     268  ->with('response')->begin() 
     269    ->isRedirected() 
     270    ->isStatusCode(302) 
     271  ->end() 
     272  ->followRedirect() 
     273  ->with('request')->begin() 
     274    ->isParameter('module', 'ullUser') 
     275    ->isParameter('action', 'edit') 
     276  ->end() 
     277  ->with('response')->begin() 
     278    ->isStatusCode(200) 
     279  ->end() 
     280  ->click('Result list')   
     281   
     282  ->with('request')->begin() 
     283    ->isParameter('module', 'ullUser') 
     284    ->isParameter('action', 'list') 
     285  ->end()      
    246286  ->with('response')->begin() 
    247287    ->isStatusCode(200) 
  • trunk/test/functional/frontend/ullCorePlugin/ullUserSearchTypesTest.php

    r1496 r1682  
    8585    ->isParameter('action', 'list') 
    8686  ->end() 
     87   
     88  // redirect to edit if single result 
     89  ->with('response')->begin() 
     90    ->isRedirected() 
     91    ->isStatusCode(302) 
     92  ->end() 
     93  ->followRedirect() 
     94  ->with('request')->begin() 
     95    ->isParameter('module', 'ullUser') 
     96    ->isParameter('action', 'edit') 
     97  ->end() 
     98  ->with('response')->begin() 
     99    ->isStatusCode(200) 
     100  ->end() 
     101  ->click('Result list')   
     102   
     103  ->with('request')->begin() 
     104    ->isParameter('module', 'ullUser') 
     105    ->isParameter('action', 'list') 
     106  ->end()      
    87107  ->with('response')->begin() 
    88108    ->isStatusCode(200) 
     
    120140    ->isParameter('action', 'list') 
    121141  ->end() 
     142   
     143  // redirect to edit if single result 
     144  ->with('response')->begin() 
     145    ->isRedirected() 
     146    ->isStatusCode(302) 
     147  ->end() 
     148  ->followRedirect() 
     149  ->with('request')->begin() 
     150    ->isParameter('module', 'ullUser') 
     151    ->isParameter('action', 'edit') 
     152  ->end() 
     153  ->with('response')->begin() 
     154    ->isStatusCode(200) 
     155  ->end() 
     156  ->click('Result list')   
     157   
     158  ->with('request')->begin() 
     159    ->isParameter('module', 'ullUser') 
     160    ->isParameter('action', 'list') 
     161  ->end()      
    122162  ->with('response')->begin() 
    123163    ->isStatusCode(200) 
     
    155195    ->isParameter('action', 'list') 
    156196  ->end() 
     197   
     198  // redirect to edit if single result 
     199  ->with('response')->begin() 
     200    ->isRedirected() 
     201    ->isStatusCode(302) 
     202  ->end() 
     203  ->followRedirect() 
     204  ->with('request')->begin() 
     205    ->isParameter('module', 'ullUser') 
     206    ->isParameter('action', 'edit') 
     207  ->end() 
     208  ->with('response')->begin() 
     209    ->isStatusCode(200) 
     210  ->end() 
     211  ->click('Result list')   
     212   
     213  ->with('request')->begin() 
     214    ->isParameter('module', 'ullUser') 
     215    ->isParameter('action', 'list') 
     216  ->end()      
    157217  ->with('response')->begin() 
    158218    ->isStatusCode(200) 
  • trunk/test/unit/ullCorePlugin/ullUserDeactivationTaskTest.php

    r1677 r1682  
    1616$app = 'frontend'; 
    1717 
    18 $t->begin('execute()'); 
     18$t->begin('deactivateUsers()'); 
    1919 
    2020  $q = new UllQuery('UllUser'); 
     
    2323 
    2424  $task = new UserDeactivationTask(new sfEventDispatcher(), new sfFormatter()); 
    25   $task->execute(array('application' => $app, 'env' => 'test')); 
     25  $task->deactivateUsers(array('application' => $app, 'env' => 'test')); 
    2626   
    2727  $q = new UllQuery('UllUser'); 
     
    3535   
    3636  $task = new UserDeactivationTask(new sfEventDispatcher(), new sfFormatter()); 
    37   $task->execute(array('application' => $app, 'env' => 'test'));   
     37  $task->deactivateUsers(array('application' => $app, 'env' => 'test'));   
    3838 
    3939  $q = new UllQuery('UllUser'); 
     
    4646   
    4747  $task = new UserDeactivationTask(new sfEventDispatcher(), new sfFormatter()); 
    48   $task->execute(array('application' => $app, 'env' => 'test')); 
     48  $task->deactivateUsers(array('application' => $app, 'env' => 'test')); 
    4949   
    5050  $q = new UllQuery('UllUser');