move Auth_ParseSearchHistoryCookie.t to db_dependent directory
authorGalen Charlton <gmc@esilibrary.com>
Sun, 28 Jul 2013 19:42:51 +0000 (19:42 +0000)
committerGalen Charlton <gmc@esilibrary.com>
Sun, 28 Jul 2013 19:42:51 +0000 (19:42 +0000)
The actual tests in this script are not dependent on the database,
but simply loading C4::Auth requires a valid(ish) koha-conf.xml
and database.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
t/Auth_ParseSearchHistoryCookie.t [deleted file]
t/db_dependent/Auth_ParseSearchHistoryCookie.t [new file with mode: 0644]

diff --git a/t/Auth_ParseSearchHistoryCookie.t b/t/Auth_ParseSearchHistoryCookie.t
deleted file mode 100644 (file)
index 507ac91..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-#!/usr/bin/perl
-
-use strict;
-use warnings;
-
-use Test::More tests => 3;
-
-use_ok('C4::Auth', qw/ParseSearchHistoryCookie/);
-
-my $valid_cookie = "%5B%7B%22time%22%3A1374978877%2C%22query_cgi%22%3A%22idx%3D%26q%3Dhistory%26branch_group_limit%3D%22%2C%22total%22%3A2%2C%22query_desc%22%3A%22kw%2Cwrdl%3A%20history%2C%20%22%7D%5D";
-my $expected_recent_searches = [
-    {
-        'time' => 1374978877,
-        'query_cgi' => 'idx=&q=history&branch_group_limit=',
-        'total' => 2,
-        'query_desc' => 'kw,wrdl: history, '
-    }
-];
-
-my $input = CookieSimulator->new($valid_cookie);
-my @recent_searches = ParseSearchHistoryCookie($input);
-is_deeply(\@recent_searches, $expected_recent_searches, 'parsed valid search history cookie value');
-
-# simulate bit of a Storable-based search history cookie
-my $invalid_cookie = "%04%08%0812345";
-$input = CookieSimulator->new($invalid_cookie);
-@recent_searches = ParseSearchHistoryCookie($input);
-is_deeply(\@recent_searches, [], 'got back empty search history list if given invalid cookie');
-
-package CookieSimulator;
-
-sub new {
-    my ($class, $str) = @_;
-    my $val = [ $str ];
-    return bless $val, $class;
-}
-
-sub cookie {
-    my $self = shift;
-    return $self->[0];
-}
-
-1;
diff --git a/t/db_dependent/Auth_ParseSearchHistoryCookie.t b/t/db_dependent/Auth_ParseSearchHistoryCookie.t
new file mode 100644 (file)
index 0000000..507ac91
--- /dev/null
@@ -0,0 +1,43 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+use Test::More tests => 3;
+
+use_ok('C4::Auth', qw/ParseSearchHistoryCookie/);
+
+my $valid_cookie = "%5B%7B%22time%22%3A1374978877%2C%22query_cgi%22%3A%22idx%3D%26q%3Dhistory%26branch_group_limit%3D%22%2C%22total%22%3A2%2C%22query_desc%22%3A%22kw%2Cwrdl%3A%20history%2C%20%22%7D%5D";
+my $expected_recent_searches = [
+    {
+        'time' => 1374978877,
+        'query_cgi' => 'idx=&q=history&branch_group_limit=',
+        'total' => 2,
+        'query_desc' => 'kw,wrdl: history, '
+    }
+];
+
+my $input = CookieSimulator->new($valid_cookie);
+my @recent_searches = ParseSearchHistoryCookie($input);
+is_deeply(\@recent_searches, $expected_recent_searches, 'parsed valid search history cookie value');
+
+# simulate bit of a Storable-based search history cookie
+my $invalid_cookie = "%04%08%0812345";
+$input = CookieSimulator->new($invalid_cookie);
+@recent_searches = ParseSearchHistoryCookie($input);
+is_deeply(\@recent_searches, [], 'got back empty search history list if given invalid cookie');
+
+package CookieSimulator;
+
+sub new {
+    my ($class, $str) = @_;
+    my $val = [ $str ];
+    return bless $val, $class;
+}
+
+sub cookie {
+    my $self = shift;
+    return $self->[0];
+}
+
+1;