|
Lines 2-8
Link Here
|
| 2 |
|
2 |
|
| 3 |
use Modern::Perl; |
3 |
use Modern::Perl; |
| 4 |
use DBI; |
4 |
use DBI; |
| 5 |
use Test::More tests => 10; |
5 |
use Test::More tests => 20; |
| 6 |
use Test::MockModule; |
6 |
use Test::MockModule; |
| 7 |
|
7 |
|
| 8 |
BEGIN { |
8 |
BEGIN { |
|
Lines 35-37
is(C4::Context::db_scheme2dbi('mysql'), 'mysql', 'ask for mysql, get mysql');
Link Here
|
| 35 |
is(C4::Context::db_scheme2dbi('Pg'), 'Pg', 'ask for Pg, get Pg'); |
35 |
is(C4::Context::db_scheme2dbi('Pg'), 'Pg', 'ask for Pg, get Pg'); |
| 36 |
is(C4::Context::db_scheme2dbi('xxx'), 'mysql', 'ask for unsupported DBMS, get mysql'); |
36 |
is(C4::Context::db_scheme2dbi('xxx'), 'mysql', 'ask for unsupported DBMS, get mysql'); |
| 37 |
is(C4::Context::db_scheme2dbi(), 'mysql', 'ask for nothing, get mysql'); |
37 |
is(C4::Context::db_scheme2dbi(), 'mysql', 'ask for nothing, get mysql'); |
| 38 |
- |
38 |
|
|
|
39 |
# C4::Context::interface |
| 40 |
my $lastwarn; |
| 41 |
local $SIG{__WARN__} = sub { $lastwarn = $_[0] }; |
| 42 |
is(C4::Context->interface, 'opac'); |
| 43 |
is(C4::Context->interface('foobar'), 'opac'); |
| 44 |
like($lastwarn, qr/invalid interface : 'foobar'/); |
| 45 |
is(C4::Context->interface, 'opac'); |
| 46 |
is(C4::Context->interface('intranet'), 'intranet'); |
| 47 |
is(C4::Context->interface, 'intranet'); |
| 48 |
is(C4::Context->interface('foobar'), 'intranet'); |
| 49 |
is(C4::Context->interface, 'intranet'); |
| 50 |
is(C4::Context->interface('OPAC'), 'opac'); |
| 51 |
is(C4::Context->interface, 'opac'); |