|
Lines 1-7
Link Here
|
| 1 |
#!/usr/bin/perl |
1 |
#!/usr/bin/perl |
| 2 |
# |
|
|
| 3 |
# This Koha test module is a stub! |
| 4 |
# Add more tests here!!! |
| 5 |
|
2 |
|
| 6 |
use Modern::Perl; |
3 |
use Modern::Perl; |
| 7 |
|
4 |
|
|
Lines 10-16
use CGI qw ( -utf8 );
Link Here
|
| 10 |
use Test::MockObject; |
7 |
use Test::MockObject; |
| 11 |
use Test::MockModule; |
8 |
use Test::MockModule; |
| 12 |
use List::MoreUtils qw/all any none/; |
9 |
use List::MoreUtils qw/all any none/; |
| 13 |
use Test::More tests => 17; |
10 |
use Test::More tests => 18; |
| 14 |
use Test::Warn; |
11 |
use Test::Warn; |
| 15 |
use t::lib::Mocks; |
12 |
use t::lib::Mocks; |
| 16 |
use t::lib::TestBuilder; |
13 |
use t::lib::TestBuilder; |
|
Lines 981-984
subtest 'create_basic_session tests' => sub {
Link Here
|
| 981 |
is( $session->param('interface'), 'intranet', 'Staff interface gets converted to intranet' ); |
978 |
is( $session->param('interface'), 'intranet', 'Staff interface gets converted to intranet' ); |
| 982 |
}; |
979 |
}; |
| 983 |
|
980 |
|
|
|
981 |
subtest 'check_cookie_auth overwriting interface already set' => sub { |
| 982 |
plan tests => 2; |
| 983 |
|
| 984 |
t::lib::Mocks::mock_preference( 'SessionRestrictionByIP', 0 ); |
| 985 |
|
| 986 |
my $patron = $builder->build_object({ class => 'Koha::Patrons' }); |
| 987 |
my $session = C4::Auth::get_session(); |
| 988 |
$session->param( 'number', $patron->id ); |
| 989 |
$session->param( 'id', $patron->userid ); |
| 990 |
$session->param( 'ip', '1.2.3.4' ); |
| 991 |
$session->param( 'lasttime', time() ); |
| 992 |
$session->param( 'interface', 'opac' ); |
| 993 |
$session->flush; |
| 994 |
|
| 995 |
C4::Context->interface('intranet'); |
| 996 |
C4::Auth::check_cookie_auth( $session->id ); |
| 997 |
is( C4::Context->interface, 'intranet', 'check_cookie_auth did not overwrite' ); |
| 998 |
delete $C4::Context::context->{interface}; # clear context interface |
| 999 |
C4::Auth::check_cookie_auth( $session->id ); |
| 1000 |
is( C4::Context->interface, 'opac', 'check_cookie_auth used interface from session when context interface was empty' ); |
| 1001 |
|
| 1002 |
t::lib::Mocks::mock_preference( 'SessionRestrictionByIP', 1 ); |
| 1003 |
}; |
| 1004 |
|
| 984 |
$schema->storage->txn_rollback; |
1005 |
$schema->storage->txn_rollback; |
| 985 |
- |
|
|