Add in Data::Perl::Collection::Set from DBIx-Data-Store-old so we can run tests.
[catagits/App-IdiotBox.git] / t / show / bucket.t
CommitLineData
71fd1550 1use strict;
6b6ce2e0 2use lib qw(t/lib/);
71fd1550 3use warnings FATAL => 'all';
4use Test::More;
5
6use App::IdiotBox;
7use Data::Perl::Collection::Set;
8use Scalar::Util qw(weaken);
9
10my $idiotbox = App::IdiotBox->new({
11 config => { template_dir => 'share/html' }
12});
13
14my $bucket = bless({
15 slug => 'lpw2009',
16 name => 'London Perl Workshop 2009',
17}, 'App::IdiotBox::Bucket');
18
19my %vid;
20
21$bucket->{videos} = Data::Perl::Collection::Set->new(
22 members => [ map {
23 my $o = bless(
24 { %$_, bucket => $bucket, details => '' },
25 'App::IdiotBox::Video'
26 );
27 weaken($o->{bucket});
28 $vid{$o->{slug}} = $o
29 }
30 { name => 'The M Word', slug => 'm-word', author => 'davorg' },
31 { name => 'Dreamcasting', slug => 'dream', author => 'mst' },
32 ]
33);
34
35sub slurp_html {
36 my $string;
37 my $fh = $_[0]->[-1];
38 while (defined (my $chunk = $fh->getline)) {
39 $string .= $chunk;
40 }
41 $string;
42}
43
44my $bucket_result = $idiotbox->show_bucket($bucket);
45
46my $html = slurp_html($bucket_result);
47
48warn $html;
49
50warn "\n\n------\n\n";
51
52my $video_result = $idiotbox->show_video($vid{dream});
53
54$html = slurp_html($video_result);
55
56warn $html;
57
58pass;
59
60done_testing;