Merge remote-tracking branch 'origin/new/bug_7284'
[koha.git] / t / db_dependent / Amazon.t
1 #!/usr/bin/perl
2 #
3 # This Koha test module is a stub!  
4 # Add more tests here!!!
5
6 use strict;
7 use warnings;
8
9 use Test::More tests => 8;
10 use C4::Context;
11
12 BEGIN {
13         use_ok('C4::External::Amazon');
14 }
15
16 my $context = C4::Context->new();
17
18 my $locale = $context->preference('AmazonLocale');
19
20 $context->set_preference('AmazonLocale','CA');
21 $context->clear_syspref_cache();
22 is(get_amazon_tld,'.ca','Changes locale to CA and tests get_amazon_tld');
23
24 $context->set_preference('AmazonLocale','DE');
25 $context->clear_syspref_cache();
26 is(get_amazon_tld,'.de','Changes locale to DE and tests get_amazon_tld');
27
28 $context->set_preference('AmazonLocale','FR');
29 $context->clear_syspref_cache();
30 is(get_amazon_tld,'.fr','Changes locale to FR and tests get_amazon_tld');
31
32 $context->set_preference('AmazonLocale','JP');
33 $context->clear_syspref_cache();
34 is(get_amazon_tld,'.jp','Changes locale to JP and tests get_amazon_tld');
35
36 $context->set_preference('AmazonLocale','UK');
37 $context->clear_syspref_cache();
38 is(get_amazon_tld,'.co.uk','Changes locale to UK and tests get_amazon_tld');
39
40 $context->set_preference('AmazonLocale','US');
41 $context->clear_syspref_cache();
42 is(get_amazon_tld,'.com','Changes locale to US and tests get_amazon_tld');
43
44 $context->set_preference('AmazonLocale','NZ');
45 $context->clear_syspref_cache();
46 is(get_amazon_tld,'.com','Changes locale to one not in the array and tests get_amazon_tld');
47
48 $context->set_preference('AmazonLocale',$locale);
49 $context->clear_syspref_cache();