Bug 20434: Update UNIMARC framework - auth (TM)
[koha.git] / t / db_dependent / Amazon.t
blob2304073931667f2390b8bfdbf12399e5db2a55fa
1 #!/usr/bin/perl
3 # This Koha test module is a stub!
4 # Add more tests here!!!
6 use strict;
7 use warnings;
9 use Test::More tests => 8;
10 use t::lib::Mocks;
11 use C4::Context;
13 BEGIN {
14 use_ok('C4::External::Amazon');
17 my $context = C4::Context->new();
19 my $locale = $context->preference('AmazonLocale');
21 t::lib::Mocks::mock_preference('AmazonLocale','CA');
22 $context->clear_syspref_cache();
23 is(get_amazon_tld,'.ca','Changes locale to CA and tests get_amazon_tld');
25 t::lib::Mocks::mock_preference('AmazonLocale','DE');
26 $context->clear_syspref_cache();
27 is(get_amazon_tld,'.de','Changes locale to DE and tests get_amazon_tld');
29 t::lib::Mocks::mock_preference('AmazonLocale','FR');
30 $context->clear_syspref_cache();
31 is(get_amazon_tld,'.fr','Changes locale to FR and tests get_amazon_tld');
33 t::lib::Mocks::mock_preference('AmazonLocale','JP');
34 $context->clear_syspref_cache();
35 is(get_amazon_tld,'.jp','Changes locale to JP and tests get_amazon_tld');
37 t::lib::Mocks::mock_preference('AmazonLocale','UK');
38 $context->clear_syspref_cache();
39 is(get_amazon_tld,'.co.uk','Changes locale to UK and tests get_amazon_tld');
41 t::lib::Mocks::mock_preference('AmazonLocale','US');
42 $context->clear_syspref_cache();
43 is(get_amazon_tld,'.com','Changes locale to US and tests get_amazon_tld');
45 t::lib::Mocks::mock_preference('AmazonLocale','NZ');
46 $context->clear_syspref_cache();
47 is(get_amazon_tld,'.com','Changes locale to one not in the array and tests get_amazon_tld');
49 t::lib::Mocks::mock_preference('AmazonLocale',$locale);
50 $context->clear_syspref_cache();