View | Details | Raw Unified | Return to bug 12404
Collapse All | Expand All

(-)a/t/db_dependent/Record/marcrecord2csv.t (-2 / +33 lines)
Lines 1-7 Link Here
1
#!/usr/bin/perl;
1
#!/usr/bin/perl;
2
2
3
use Modern::Perl;
3
use Modern::Perl;
4
use Test::More tests => 4;
4
use Test::More tests => 8;
5
use Test::MockModule;
5
use Test::MockModule;
6
use MARC::Record;
6
use MARC::Record;
7
use MARC::Field;
7
use MARC::Field;
Lines 47-52 $csv_output = C4::Record::marcrecord2csv( $biblionumber, $csv_profile_id_2, 0, $ Link Here
47
is( $csv_output, q["The art of computer programming,Donald E. Knuth.,0;The art of another title,Donald E. Knuth. II,1"|"Computer programming.,462;Computer algorithms.,499"
47
is( $csv_output, q["The art of computer programming,Donald E. Knuth.,0;The art of another title,Donald E. Knuth. II,1"|"Computer programming.,462;Computer algorithms.,499"
48
], q|normal way: headers are not display if not needed| );
48
], q|normal way: headers are not display if not needed| );
49
49
50
$csv_content = q(Title and author=[% FOREACH field IN fields.245 %][% field.a.0 %] [% field.c.0 %][% END %]|Subject=650$a);
51
my $csv_profile_id_3 = insert_csv_profile({ csv_content => $csv_content });
52
53
$csv_output = C4::Record::marcrecord2csv( $biblionumber, $csv_profile_id_3, 1, $csv );
54
is( $csv_output, q["Title and author"|Subject
55
"The art of computer programming Donald E. Knuth.The art of another title Donald E. Knuth. II"|"Computer programming.,Computer algorithms."
56
], q|TT way: display all 245$a and 245$c| );
57
58
$csv_content = q(Subject=[% FOREACH field IN fields.650 %][% IF field.indicator.2 %][% field.a.0 %][% END %][% END %]);
59
my $csv_profile_id_4 = insert_csv_profile({ csv_content => $csv_content });
60
61
$csv_output = C4::Record::marcrecord2csv( $biblionumber, $csv_profile_id_4, 1, $csv );
62
is( $csv_output, q[Subject
63
"Computer programming."
64
], q|TT way: display 650$a if indicator 2 for 650 is set| );
65
66
$csv_content = q|Language=[% fields.008.0.substr( 28, 3 ) %]|;
67
my $csv_profile_id_5 = insert_csv_profile({ csv_content => $csv_content });
68
69
$csv_output = C4::Record::marcrecord2csv( $biblionumber, $csv_profile_id_5, 1, $csv );
70
is( $csv_output, q[Language
71
eng
72
], q|TT way: export language from the control field 008| );
73
74
$csv_content = q|Title=[% IF fields.100.0.indicator.1 %][% fields.245.0.a.0 %][% END %]|;
75
my $csv_profile_id_6 = insert_csv_profile({ csv_content => $csv_content });
76
77
$csv_output = C4::Record::marcrecord2csv( $biblionumber, $csv_profile_id_6, 1, $csv );
78
is( $csv_output, q[Title
79
"The art of computer programming"
80
], q|TT way: display first subfield a for first field 245 if indicator 1 for field 100 is set| );
81
50
sub insert_csv_profile {
82
sub insert_csv_profile {
51
    my ( $params ) = @_;
83
    my ( $params ) = @_;
52
    my $csv_content = $params->{csv_content};
84
    my $csv_content = $params->{csv_content};
53
- 

Return to bug 12404