diff options
Diffstat (limited to 'perllib/t')
-rwxr-xr-x | perllib/t/Cobrand.t | 40 | ||||
-rw-r--r-- | perllib/t/Cobrands/Mysite/Util.pm | 28 | ||||
-rw-r--r-- | perllib/t/MockQuery.pm | 28 | ||||
-rwxr-xr-x | perllib/t/Page.t | 58 | ||||
-rw-r--r-- | perllib/t/templates/mysite/test-header | 1 |
5 files changed, 0 insertions, 155 deletions
diff --git a/perllib/t/Cobrand.t b/perllib/t/Cobrand.t deleted file mode 100755 index c9ad93b65..000000000 --- a/perllib/t/Cobrand.t +++ /dev/null @@ -1,40 +0,0 @@ -#!/usr/bin/perl -w -# -# Cobrand.t: -# Tests for the cobranding functions -# -# Copyright (c) 2009 UK Citizens Online Democracy. All rights reserved. -# Email: louise@mysociety.org; WWW: http://www.mysociety.org/ -# -# $Id: Cobrand.t,v 1.2 2009-08-26 17:24:40 louise Exp $ -# - -use strict; -use warnings; -use Test::More tests => 3; -use Test::Exception; - -use FindBin; -use lib "$FindBin::Bin"; -use lib "$FindBin::Bin/../perllib"; -use lib "$FindBin::Bin/../../perllib"; - -use Cobrand; -use MockQuery; - -sub test_cobrand_page{ - my $q = new MockQuery('mysite'); - # should get the result of the page function in the cobrand module if one exists - my ($html, $params) = Cobrand::cobrand_page($q); - like($html, qr/A cobrand produced page/, 'cobrand_page returns output from cobrand module'); - - # should return 0 if no cobrand module exists - $q = new MockQuery('mynonexistingsite'); - ($html, $params) = Cobrand::cobrand_page($q); - is($html, 0, 'cobrand_page returns 0 if there is no cobrand module'); - return 1; - -} - - -ok(test_cobrand_page() == 1, 'Ran all tests for the cobrand_page function'); diff --git a/perllib/t/Cobrands/Mysite/Util.pm b/perllib/t/Cobrands/Mysite/Util.pm deleted file mode 100644 index 61f6fd831..000000000 --- a/perllib/t/Cobrands/Mysite/Util.pm +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/perl -w -# -# Util.pm: -# Test Cobranding for FixMyStreet. -# -# -# Copyright (c) 2009 UK Citizens Online Democracy. All rights reserved. -# Email: louise@mysociety.org. WWW: http://www.mysociety.org -# -# $Id: Util.pm,v 1.1 2009-08-26 16:52:15 louise Exp $ - -package Cobrands::Mysite::Util; -use Page; -use strict; -use Carp; -use mySociety::Web qw(ent); - -sub new{ - my $class = shift; - return bless {}, $class; -} - -sub page{ - my %params = (); - return ("A cobrand produced page", %params); -} - -1; diff --git a/perllib/t/MockQuery.pm b/perllib/t/MockQuery.pm deleted file mode 100644 index a6cd3ff78..000000000 --- a/perllib/t/MockQuery.pm +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/perl -w -# -# MockQuery.pm: -# Mock query to support 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: MockQuery.pm,v 1.1 2009-08-26 16:52:14 louise Exp $ -# - - -package MockQuery; - -sub new{ - my $class = shift; - my $self = { - site => shift, - }; - bless $self, $class; - return $self; -} - -sub header{ - -} - -1; diff --git a/perllib/t/Page.t b/perllib/t/Page.t deleted file mode 100755 index 2890dda1e..000000000 --- a/perllib/t/Page.t +++ /dev/null @@ -1,58 +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.2 2009-08-26 16:52:14 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/../../perllib"; - -use Page; -use MockQuery; -use mySociety::Locale; - -sub mock_query(){ - my $q = new MockQuery('mysite'); - return $q; -} - -sub test_header(){ - my $q = mock_query(); - my $html; - my %params = (title => 'test title'); - mySociety::Locale::negotiate_language('en-gb,English,en_GB'); - mySociety::Locale::gettext_domain('FixMyStreet'); - mySociety::Locale::change(); - - # Test that param that isn't explicitly allowed raises error - $params{'test-param'} = 'test'; - throws_ok { Page::header($q, %params); } qr/bad parameter/, 'bad parameter caught ok'; - delete $params{'test-param'}; - - # Test that template passed is rendered - $params{'template'} = 'test'; - $html = Page::template_header('My test title', 'test', $q, 'en-gb', '/../t/templates/'); - like ($html, qr/My test header template/, 'named template rendered ok'); - - - return 1; -} - -sub test_footer(){ - return 1; -} - -ok(test_footer() == 1, 'Ran all tests for the footer function'); -ok(test_header() == 1, 'Ran all tests for the header function'); diff --git a/perllib/t/templates/mysite/test-header b/perllib/t/templates/mysite/test-header deleted file mode 100644 index 83d959d3d..000000000 --- a/perllib/t/templates/mysite/test-header +++ /dev/null @@ -1 +0,0 @@ -My test header template |