7 use Test
::More tests
=> 5;
11 use_ok
('C4::SocialData');
14 my $module = new Test
::MockModule
('C4::Context');
18 my $dbh = DBI
->connect( 'DBI:Mock:', '', '' )
19 || die "Cannot create handle: $DBI::errstr\n";
25 'isbn', 'num_critics',
26 'num_critics_pro', 'num_quotations',
27 'num_videos', 'score_avg',
30 [ '0-596-52674-1', 1, 2, 3, 4, 5.2, 6 ],
31 [ '0-596-00289-0', 2, 3, 4, 5, 6.2, 7 ]
33 my $dbh = C4
::Context
->dbh();
35 $dbh->{mock_add_resultset
} = $socialdata;
37 my $data = C4
::SocialData
::get_data
();
39 is
( $data->{'isbn'}, '0-596-52674-1', 'First isbn is 0-596-52674-1' );
42 [ [ 'biblionumber', 'isbn' ], [ 1, '0-596-52674-1' ],
43 [ 2, '0-596-00289-0' ] ];
47 $dbh->{mock_add_resultset
} = $reportdata;
49 ok
( my $report = C4
::SocialData
::get_report
() );
51 is
( $report->{'without'}->[0]->{'original'},
52 '0-596-52674-1', 'testing get_report gives isbn' );
54 is
( $report->{'without'}->[0]->{'isbn'}, '9780596526740',
55 'testing get_report' );