diff options
Diffstat (limited to 't')
-rwxr-xr-x | t/Cobrand.t | 7 | ||||
-rw-r--r-- | t/Cobrands/Mysite/Util.pm | 1 | ||||
-rwxr-xr-x | t/Page.t | 55 | ||||
-rw-r--r-- | t/fakeq.t | 24 |
4 files changed, 7 insertions, 80 deletions
diff --git a/t/Cobrand.t b/t/Cobrand.t index d3857e523..047fcc71c 100755 --- a/t/Cobrand.t +++ b/t/Cobrand.t @@ -21,7 +21,14 @@ use lib "$FindBin::Bin/../perllib"; use lib "$FindBin::Bin/../commonlib/perllib"; use Cobrand; +use Problems; use mySociety::MockQuery; +use mySociety::Config; + +BEGIN { + (my $dir = __FILE__) =~ s{/[^/]*?$}{}; + mySociety::Config::set_file("$dir/../conf/general"); +} sub test_site_restriction { my ($site_restriction, $site_id) = Cobrand::site_restriction('mysite', 'test'); diff --git a/t/Cobrands/Mysite/Util.pm b/t/Cobrands/Mysite/Util.pm index 65591528f..b733cb5b7 100644 --- a/t/Cobrands/Mysite/Util.pm +++ b/t/Cobrands/Mysite/Util.pm @@ -10,7 +10,6 @@ # $Id: Util.pm,v 1.20 2009-12-16 12:43:13 matthew Exp $ package Cobrands::Mysite::Util; -use Page; use strict; use Carp; use mySociety::Web qw(ent); diff --git a/t/Page.t b/t/Page.t deleted file mode 100755 index 9331d4ef9..000000000 --- a/t/Page.t +++ /dev/null @@ -1,55 +0,0 @@ -#!/usr/bin/perl -w -# -# Page.t: -# Tests for the Page functions -# -# Copyright (c) 2009 UK Citizens Online Democracy. All rights reserved. -# Email: louise@mysociety.org; WWW: http://www.mysociety.org/ -# -# $Id: Page.t,v 1.12 2009-12-09 13:34:36 louise Exp $ -# - -use strict; -use warnings; -use Test::More tests => 4; -use Test::Exception; - -use FindBin; -use lib "$FindBin::Bin"; -use lib "$FindBin::Bin/../perllib"; -use lib "$FindBin::Bin/../commonlib/perllib"; - -use Page; -use FixMyStreet::Geocode; -use mySociety::MockQuery; -use mySociety::Locale; - -sub mock_query(){ - my $q = new MockQuery('mysite'); - return $q; -} - -sub set_lang($) { - my $lang = shift; - mySociety::Locale::negotiate_language($lang); - mySociety::Locale::gettext_domain('FixMyStreet'); - mySociety::Locale::change(); -} - -sub test_base_url_with_lang { - set_lang('en-gb,English,en_GB'); - my $q = mock_query(); - my $url = Page::base_url_with_lang($q); - ok($url eq 'http://mysite.example.com', 'Basic url rendered ok'); - - $q = new MockQuery('emptyhomes'); - $url = Page::base_url_with_lang($q); - like($url, qr/http:\/\/en\.emptyhomes\./, 'Empty homes url with lang returned ok'); - - $url = Page::base_url_with_lang($q, 1); - like($url, qr/http:\/\/cy\.emptyhomes\./, 'Empty homes url with lang reversed returned ok'); - -} - - -ok(test_base_url_with_lang() == 1, 'Ran all tests for base_url_with_lang'); diff --git a/t/fakeq.t b/t/fakeq.t deleted file mode 100644 index ae7c6d98b..000000000 --- a/t/fakeq.t +++ /dev/null @@ -1,24 +0,0 @@ -use strict; -use warnings; - -use Test::More; - -use_ok 'FixMyStreet::FakeQ'; - -# create a new object and check that it returns what we want. -my $fake_q = FixMyStreet::FakeQ->new( - { - params => { foo => 'bar' }, # - site => 'boing' - } -); - -is $fake_q->{site}, 'boing', 'got site verbatim'; -is $fake_q->param('foo'), 'bar', 'got set param'; -is $fake_q->param('not_set'), undef, 'got undef for not set param'; - -# check that setting site to 'default' gets translated to fixmystreet -is FixMyStreet::FakeQ->new( { site => 'default' } )->{site}, 'fixmystreet', - "'default' site becomes 'fixmystreet'"; - -done_testing(); |