Bug 17600: Standardize our EXPORT_OK
[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 t::lib::Mocks;
11 use C4::Context;
12
13 BEGIN {
14     use_ok('C4::External::Amazon', qw( get_amazon_tld ));
15 }
16
17 my $context = C4::Context->new();
18
19 my $locale = $context->preference('AmazonLocale');
20
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');
24
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');
28
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');
32
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');
36
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');
40
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');
44
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');
48
49 t::lib::Mocks::mock_preference('AmazonLocale',$locale);
50 $context->clear_syspref_cache();