View | Details | Raw Unified | Return to bug 36367
Collapse All | Expand All

(-)a/t/db_dependent/Auth.t (-5 / +2 lines)
Lines 761-767 subtest 'check_cookie_auth' => sub { Link Here
761
};
761
};
762
762
763
subtest 'checkauth & check_cookie_auth' => sub {
763
subtest 'checkauth & check_cookie_auth' => sub {
764
    plan tests => 34;
764
    plan tests => 33;
765
765
766
    # flags = 4 => { catalogue => 1 }
766
    # flags = 4 => { catalogue => 1 }
767
    my $patron = $builder->build_object({ class => 'Koha::Patrons', value => { flags => 4 } });
767
    my $patron = $builder->build_object({ class => 'Koha::Patrons', value => { flags => 4 } });
Lines 907-920 subtest 'checkauth & check_cookie_auth' => sub { Link Here
907
        is( $auth_status, "ok" );
907
        is( $auth_status, "ok" );
908
        is( $session->id, $sessionID, 'Same session' );
908
        is( $session->id, $sessionID, 'Same session' );
909
        # Two additional tests on userenv
909
        # Two additional tests on userenv
910
        is( $C4::Context::context->{activeuser}, $session->id, 'Check if environment has been setup for session' );
911
        is( C4::Context->userenv->{id}, $userid, 'Check userid in userenv' );
910
        is( C4::Context->userenv->{id}, $userid, 'Check userid in userenv' );
912
    }
911
    }
913
};
912
};
914
913
915
subtest 'Userenv clearing in check_cookie_auth' => sub {
914
subtest 'Userenv clearing in check_cookie_auth' => sub {
916
    # Note: We did already test userenv for a logged-in user in previous subtest
915
    # Note: We did already test userenv for a logged-in user in previous subtest
917
    plan tests => 9;
916
    plan tests => 8;
918
917
919
    t::lib::Mocks::mock_preference( 'timeout', 600 );
918
    t::lib::Mocks::mock_preference( 'timeout', 600 );
920
    my $cgi = CGI->new;
919
    my $cgi = CGI->new;
Lines 924-930 subtest 'Userenv clearing in check_cookie_auth' => sub { Link Here
924
    my ($userid, $cookie, $sessionID, $flags ) = C4::Auth::checkauth($cgi, 1);
923
    my ($userid, $cookie, $sessionID, $flags ) = C4::Auth::checkauth($cgi, 1);
925
    my ( $auth_status, $session) = C4::Auth::check_cookie_auth( $sessionID );
924
    my ( $auth_status, $session) = C4::Auth::check_cookie_auth( $sessionID );
926
    is( $auth_status, 'anon', 'Should be anonymous' );
925
    is( $auth_status, 'anon', 'Should be anonymous' );
927
    is( $C4::Context::context->{activeuser}, $session->id, 'Check activeuser' );
928
    is( defined C4::Context->userenv, 1, 'There should be a userenv' );
926
    is( defined C4::Context->userenv, 1, 'There should be a userenv' );
929
    is(  C4::Context->userenv->{id}, q{}, 'userid should be empty string' );
927
    is(  C4::Context->userenv->{id}, q{}, 'userid should be empty string' );
930
928
931
- 

Return to bug 36367