Bug 19489: (QA follow-up) Update test to use objects and module methods for creating...
[koha.git] / t / Context.t
index 9bad321..e2c1825 100755 (executable)
@@ -2,7 +2,7 @@
 
 use Modern::Perl;
 use DBI;
-use Test::More tests => 16;
+use Test::More tests => 26;
 use Test::MockModule;
 
 BEGIN {
@@ -46,7 +46,19 @@ is(C4::Context::db_scheme2dbi('Pg'),    'Pg',    'ask for Pg, get Pg');
 is(C4::Context::db_scheme2dbi('xxx'),   'mysql', 'ask for unsupported DBMS, get mysql');
 is(C4::Context::db_scheme2dbi(),        'mysql', 'ask for nothing, get mysql');
 
-my $oConnection = C4::Context->Zconn('biblioserver', 0);
-isnt($oConnection->option('async'), 1, "ZOOM connection is synchronous");
-$oConnection = C4::Context->Zconn('biblioserver', 1);
-is($oConnection->option('async'), 1, "ZOOM connection is asynchronous");
+# C4::Context::interface
+my $lastwarn;
+local $SIG{__WARN__} = sub { $lastwarn = $_[0] };
+is(C4::Context->interface, 'opac','interface defaults to opac');
+is(C4::Context->interface('foobar'), 'opac', 'interface foobar');
+like($lastwarn, qr/invalid interface : 'foobar'/, 'interface warn on foobar');
+is(C4::Context->interface, 'opac', 'interface still opac');
+is(C4::Context->interface('intranet'), 'intranet', 'interface intranet');
+is(C4::Context->interface, 'intranet', 'interface still intranet');
+is(C4::Context->interface('foobar'), 'intranet', 'interface foobar again');
+is(C4::Context->interface, 'intranet', 'interface still intranet');
+is(C4::Context->interface('OPAC'), 'opac', 'interface OPAC uc');
+is(C4::Context->interface, 'opac', 'interface still opac');
+#Bug 14751
+is( C4::Context->interface( 'SiP' ), 'sip', 'interface SiP' );
+is( C4::Context->interface( 'COMMANDLINE' ), 'commandline', 'interface commandline uc' );