Bug 12398: Add test for C4::Auth_with_cas::_url_with_get_params
authorJulian Maurice <julian.maurice@biblibre.com>
Wed, 30 Jul 2014 12:02:11 +0000 (14:02 +0200)
committerTomas Cohen Arazi <tomascohen@gmail.com>
Fri, 1 Aug 2014 13:13:40 +0000 (10:13 -0300)
Run `prove t/db_dependent/Auth_with_cas.t` to run the test

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
t/db_dependent/Auth_with_cas.t

index 77dd21f..1c8c2ef 100755 (executable)
@@ -1,14 +1,26 @@
 #!/usr/bin/perl
-#
-# This Koha test module is a stub!  
-# Add more tests here!!!
 
-use strict;
-use warnings;
+use Modern::Perl;
 
-use Test::More tests => 1;
+use Test::More tests => 2;
+use CGI;
+
+use C4::Context;
 
 BEGIN {
         use_ok('C4::Auth_with_cas');
 }
 
+my $opac_base_url = C4::Context->preference('OpacBaseURL');
+my $query_string = 'ticket=foo&bar=baz';
+
+$ENV{QUERY_STRING} = $query_string;
+$ENV{SCRIPT_NAME} = '/cgi-bin/koha/opac-user.pl';
+
+my $cgi = new CGI($query_string);
+$cgi->delete('ticket');
+
+# _url_with_get_params should return the URL without 'ticket' parameter since it
+# has been deleted.
+is(C4::Auth_with_cas::_url_with_get_params($cgi),
+    "$opac_base_url/cgi-bin/koha/opac-user.pl?bar=baz");