6 use Test
::More tests
=> 10;
14 my $dbh = C4
::Context
->dbh;
15 $dbh->{AutoCommit
} = 0;
16 $dbh->{RaiseError
} = 1;
18 $dbh->do('DELETE FROM export_format');
20 my $sth = $dbh->prepare(q{
21 INSERT INTO export_format (profile, description, content, type)
24 $sth->execute('MARC', 'MARC profile', '245$a', 'marc');
25 $sth->execute('SQL', 'SQL profile', 'borrowers.surname', 'sql');
27 my $all_profiles = C4
::Csv
::GetCsvProfiles
();
28 is
(@
$all_profiles, 2, 'test getting all CSV profiles');
30 my $sql_profiles = C4
::Csv
::GetCsvProfiles
('sql');
31 is
(@
$sql_profiles, 1, 'test getting SQL CSV profiles');
32 is
($sql_profiles->[0]->{profile
}, 'SQL', '... and got the right one');
33 my $marc_profiles = C4
::Csv
::GetCsvProfiles
('marc');
34 is
(@
$marc_profiles, 1, 'test getting MARC CSV profiles');
35 is
($marc_profiles->[0]->{profile
}, 'MARC', '... and got the right one');
37 my $id = C4
::Csv
::GetCsvProfileId
('MARC');
38 my $profile = C4
::Csv
::GetCsvProfile
($id);
39 is
($profile->{profile
}, 'MARC', 'retrieved profile by ID');
41 is
(C4
::Csv
::GetCsvProfile
(), undef, 'test getting CSV profile but not supplying ID');
44 C4
::Csv
::GetCsvProfilesLoop
(),
47 export_format_id
=> ignore
(),
51 export_format_id
=> ignore
(),
55 'test getting profile loop'
59 C4
::Csv
::GetCsvProfilesLoop
('marc'),
62 export_format_id
=> ignore
(),
66 'test getting profile loop for one type'