Initial commit
[webservice-tdwtf.git] / t / WebService-TDWTF.t
1 #!/usr/bin/perl
2 use strict;
3 use warnings;
4
5 use Test::RequiresInternet ('thedailywtf.com' => 80);
6 use Test::More tests => 14;
7 BEGIN { use_ok('WebService::TDWTF') };
8
9 my $art = tdwtf_article;
10 ok $art->Title, 'article';
11 $art = tdwtf_article 8301;
12 is $art->Title, 'Your Recommended Virus', 'article 8301';
13 $art = tdwtf_article 'your-recommended-virus';
14 is $art->Title, 'Your Recommended Virus', 'article \'your-recommended-virus\'';
15
16 my @recent = tdwtf_list_recent;
17 is @recent, 8, 'tdwtf_list_recent';
18 @recent = tdwtf_list_recent 2;
19 is @recent, 2, 'tdwtf_list_recent 2';
20
21 my @dec15 = tdwtf_list_recent 2015, 12;
22 is $dec15[0]->Title, 'Best of 2015: The A(nti)-Team', 'tdwtf_list_recent 2015, 12';
23 is $dec15[0]->BodyHtml, '', '->BodyHtml';
24 isnt $dec15[0]->Body, '', '->Body';
25 isnt $dec15[0]->Body, '', '->Body (cached)';
26
27 my @erik = tdwtf_list_author 'erik-gern';
28 is @erik, 8, 'tdwtf_list_author \'erik-gern\'';
29
30 my @sod = tdwtf_list_series 'code-sod', 5;
31 is @sod, 5, 'tdwtf_list_series \'code-sod\', 5';
32
33
34 my ($last) = tdwtf_list_recent 1;
35 ok !defined $last->NextArticle, 'last article has no next article';
36 is $last->PreviousArticle->NextArticle->Id, $last->Id, 'next article of the previous article is current article';
This page took 0.025441 seconds and 4 git commands to generate.