| Lines 199-205
          subtest 'checkauth() tests' => sub {
      
      
        Link Here | 
        
          | 199 |         $session->param( 'interface', 'intranet' ); | 199 |         $session->param( 'interface', 'intranet' ); | 
        
          | 200 |         $session->flush; | 200 |         $session->flush; | 
        
          | 201 |         my $sessionID = $session->id; | 201 |         my $sessionID = $session->id; | 
            
              | 202 |         C4::Context->_new_userenv($sessionID); |  |  | 
        
          | 203 |  | 202 |  | 
        
          | 204 |         my ($return) = | 203 |         my ($return) = | 
        
          | 205 |             C4::Auth::check_cookie_auth( $sessionID, undef, { skip_version_check => 1, remote_addr => '1.2.3.4' } ); | 204 |             C4::Auth::check_cookie_auth( $sessionID, undef, { skip_version_check => 1, remote_addr => '1.2.3.4' } ); | 
  
    | Lines 233-239
          subtest 'checkauth() tests' => sub {
      
      
        Link Here | 
        
          | 233 |         $session->param( 'interface',    'opac' ); | 232 |         $session->param( 'interface',    'opac' ); | 
        
          | 234 |         $session->flush; | 233 |         $session->flush; | 
        
          | 235 |         my $previous_sessionID = $session->id; | 234 |         my $previous_sessionID = $session->id; | 
            
              | 236 |         C4::Context->_new_userenv($previous_sessionID); |  |  | 
        
          | 237 |  | 235 |  | 
        
          | 238 |         my ( $return ) = C4::Auth::check_cookie_auth( $previous_sessionID, undef, { skip_version_check => 1, remote_addr => '1.2.3.4' } ); | 236 |         my ( $return ) = C4::Auth::check_cookie_auth( $previous_sessionID, undef, { skip_version_check => 1, remote_addr => '1.2.3.4' } ); | 
        
          | 239 |         is( $return, 'ok', 'Former session in shape now' ); | 237 |         is( $return, 'ok', 'Former session in shape now' ); | 
  
    | Lines 262-268
          subtest 'checkauth() tests' => sub {
      
      
        Link Here | 
        
          | 262 |         $session->param( 'interface',    'intranet' ); | 260 |         $session->param( 'interface',    'intranet' ); | 
        
          | 263 |         $session->flush; | 261 |         $session->flush; | 
        
          | 264 |         $previous_sessionID = $session->id; | 262 |         $previous_sessionID = $session->id; | 
            
              | 265 |         C4::Context->_new_userenv($previous_sessionID); |  |  | 
        
          | 266 |         $cgi->param( -name => 'login_userid',             -value => $patron2->userid ); | 263 |         $cgi->param( -name => 'login_userid',             -value => $patron2->userid ); | 
        
          | 267 |         $cgi->param( -name => 'login_password',           -value => $password ); | 264 |         $cgi->param( -name => 'login_password',           -value => $password ); | 
        
          | 268 |         $cgi->param( -name => 'koha_login_context', -value => 1 ); | 265 |         $cgi->param( -name => 'koha_login_context', -value => 1 ); | 
  
    | Lines 417-423
          subtest 'checkauth() tests' => sub {
      
      
        Link Here | 
        
          | 417 |         is( $sesh->param('branch'), $branch->branchcode, "If user is superlibrarian, they should be able to choose a branch" ); | 414 |         is( $sesh->param('branch'), $branch->branchcode, "If user is superlibrarian, they should be able to choose a branch" ); | 
        
          | 418 |  | 415 |  | 
        
          | 419 |     }; | 416 |     }; | 
            
              | 420 |     C4::Context->_new_userenv; # For next tests |  |  | 
        
          | 421 | }; | 417 | }; | 
        
          | 422 |  | 418 |  | 
        
          | 423 | subtest 'no_set_userenv parameter tests' => sub { | 419 | subtest 'no_set_userenv parameter tests' => sub { | 
  
    | Lines 430-437
          subtest 'no_set_userenv parameter tests' => sub {
      
      
        Link Here | 
        
          | 430 |     my $password = set_weak_password($patron); | 426 |     my $password = set_weak_password($patron); | 
        
          | 431 |  | 427 |  | 
        
          | 432 |     ok( checkpw( $patron->userid, $password, undef, undef, 1 ), 'checkpw returns true' ); | 428 |     ok( checkpw( $patron->userid, $password, undef, undef, 1 ), 'checkpw returns true' ); | 
            
              |  |  | 429 |     C4::Context->unset_userenv; | 
        
          | 433 |     is( C4::Context->userenv, undef, 'Userenv should be undef as required' ); | 430 |     is( C4::Context->userenv, undef, 'Userenv should be undef as required' ); | 
            
              | 434 |     C4::Context->_new_userenv('DUMMY SESSION'); |  |  | 
        
          | 435 |     C4::Context->set_userenv(0,0,0,'firstname','surname', $library->branchcode, 'Library 1', 0, '', ''); | 431 |     C4::Context->set_userenv(0,0,0,'firstname','surname', $library->branchcode, 'Library 1', 0, '', ''); | 
        
          | 436 |     is( C4::Context->userenv->{branch}, $library->branchcode, 'Userenv gives correct branch' ); | 432 |     is( C4::Context->userenv->{branch}, $library->branchcode, 'Userenv gives correct branch' ); | 
        
          | 437 |     ok( checkpw( $patron->userid, $password, undef, undef, 1 ), 'checkpw returns true' ); | 433 |     ok( checkpw( $patron->userid, $password, undef, undef, 1 ), 'checkpw returns true' ); | 
  
    | Lines 940-946
          subtest 'Userenv clearing in check_cookie_auth' => sub {
      
      
        Link Here | 
        
          | 940 |     is( C4::Context->userenv, undef, 'Environment should be cleared too' ); | 936 |     is( C4::Context->userenv, undef, 'Environment should be cleared too' ); | 
        
          | 941 |  | 937 |  | 
        
          | 942 |     # Show that we clear the userenv again: set up env and check deleted session | 938 |     # Show that we clear the userenv again: set up env and check deleted session | 
            
              | 943 |     C4::Context->_new_userenv( $sessionID ); |  |  | 
        
          | 944 |     C4::Context->set_userenv; # empty | 939 |     C4::Context->set_userenv; # empty | 
        
          | 945 |     is( defined C4::Context->userenv, 1, 'There should be an empty userenv again' ); | 940 |     is( defined C4::Context->userenv, 1, 'There should be an empty userenv again' ); | 
        
          | 946 |     ( $auth_status, $session) = C4::Auth::check_cookie_auth( $sessionID ); | 941 |     ( $auth_status, $session) = C4::Auth::check_cookie_auth( $sessionID ); |