6 use Test
::More tests
=> 6;
10 use_ok
('C4::SocialData');
13 use Test
::DBIx
::Class
{
14 schema_class
=> 'Koha::Schema',
15 connect_info
=> ['dbi:SQLite:dbname=:memory:','',''],
16 connect_opts
=> { name_sep
=> '.', quote_char
=> '`', },
17 fixture_class
=> '::Populate',
18 }, 'SocialData', 'Biblioitem' ;
22 ['biblionumber', 'isbn'],
28 'isbn', 'num_critics',
29 'num_critics_pro', 'num_quotations',
30 'num_videos', 'score_avg',
33 [ '0-596-52674-1', 1, 2, 3, 4, 5.2, 6 ],
34 [ '0-596-00289-0', 2, 3, 4, 5, 6.2, 7 ]
38 my $db = Test
::MockModule
->new('Koha::Database');
39 $db->mock( _new_schema
=> sub { return Schema
(); } );
41 my $data = C4
::SocialData
::get_data
();
42 is
( $data, undef, 'get_data should return undef if no param given');
44 $data = C4
::SocialData
::get_data
('0-596-52674-1');
45 is
( $data->{isbn
}, '0-596-52674-1', 'get_data should return the matching row');
47 my $report = C4
::SocialData
::get_report
('0-596-52674-1');
49 is
( $report->{'without'}->[0]->{'original'},
50 '0-596-52674-1', 'testing get_report gives isbn' );
52 is
( $report->{'without'}->[0]->{'isbn'}, '9780596526740',
53 'testing get_report' );