root/trunk/plagger/t/plugins/Subscription-FOAF/subscription.t

Revision 852 (checked in by wolverian, 14 years ago)

Add Subscription::FOAF and a basic test. Subscribe to your friends' blogs :)

Line 
1 use strict;
2 use FindBin;
3 use File::Spec;
4 use Test::More tests => 1;
5
6 use Plagger;
7 Plagger->bootstrap(config => \<<CONFIG);
8 global:
9   log:
10     level: error
11 plugins:
12   - module: Subscription::FOAF
13     config:
14       url: file:///$FindBin::Bin/sample.foaf
15   - module: Aggregator::Test
16 CONFIG
17
18 package Plagger::Plugin::Aggregator::Test;
19 use base qw( Plagger::Plugin );
20
21 sub register {
22     my($self, $context) = @_;
23     $context->register_hook(
24         $self,
25         'customfeed.handle' => \&load,
26         'aggregator.finalize' => \&test,
27     );
28 }
29
30 sub load {
31     my($self, $context, $args) = @_;
32     push @{$self->{feeds}}, $args->{feed}->url;
33     return 1;
34 }
35
36 sub test {
37     my $self = shift;
38     ::is_deeply(
39         $self->{feeds},
40         [ 'http://usefulinc.com/edd/blog/rss91',
41           'http://www.netsplit.com/blog/index.rss',
42           'http://www.gnome.org/~jdub/blog/?flav=rss',
43           'http://blog.clearairturbulence.org/?flav=rss',
44           'http://www.hadess.net/diary.rss' ],
45     );
46 }
Note: See TracBrowser for help on using the browser.