f7c67b3ae6aa1ebe77f6f2263b9eac746c62c84b
[catagits/App-IdiotBox.git] / t / show / front_page.t
1 use strict;
2 use warnings FATAL => 'all';
3 use Test::More;
4
5 use App::IdiotBox;
6 use Data::Perl::Collection::Set;
7
8 my $idiotbox = App::IdiotBox->new({
9  config => { template_dir => 'share/html' }
10 });
11
12 my $ann = do {
13   my ($lpw, $opw) = map bless($_, 'App::IdiotBox::Bucket'),
14     { slug => 'lpw2009',
15       name => 'London Perl Workshop 2009',
16       video_count => 18 },
17     { slug => 'opw2010',
18       name => 'Perl Oasis 2010',
19       video_count => 6 };
20   my @ann = map bless($_, 'App::IdiotBox::Announcement'),
21     {
22       made_at => '2010-01-21 01:00:00',
23       bucket => $opw,
24       video_count => 3 },
25     {
26       made_at => '2010-01-01 14:00:00',
27       bucket => $lpw,
28       video_count => 5 };
29   Data::Perl::Collection::Set->new(members => [ @ann ]);
30 };
31
32 $idiotbox->{recent_announcements} = $ann;
33
34 use Devel::Dwarn;
35
36 #Dwarn
37
38 my $front = $idiotbox->show_front_page;
39
40 my $html = do {
41   my $string;
42   my $fh = $front->[-1];
43   while (defined (my $chunk = $fh->getline)) {
44     $string .= $chunk;
45   }
46   $string;
47 };
48
49 warn $html;
50
51 pass;
52
53 done_testing;
54
55 #my %test;
56
57 #HTML::Zoom->from_string($html)
58 #          ->with_selectors({
59 #              '.announcement' => [
60 #                -sub_selectors => {
61 #                  selectors => [
62                     
63