|
Lines 79-89
subtest 'read_file' => sub {
Link Here
|
| 79 |
plan tests => 6; |
79 |
plan tests => 6; |
| 80 |
|
80 |
|
| 81 |
my $file = { |
81 |
my $file = { |
| 82 |
filename => 'Test_file.tsv', |
82 |
filename => 'Test_file.csv', |
| 83 |
file_content => encode_base64( |
83 |
file_content => encode_base64( |
| 84 |
'publication_title print_identifier online_identifier date_first_issue_online num_first_vol_online num_first_issue_online date_last_issue_online num_last_vol_online num_last_issue_online title_url first_author title_id embargo_info coverage_depth coverage_notes publisher_name publication_type date_monograph_published_print date_monograph_published_online monograph_volume monograph_edition first_editor parent_publication_title_id preceding_publication_title_id access_type |
84 |
'publication_title,print_identifier,online_identifier,date_first_issue_online,num_first_vol_online,num_first_issue_online,date_last_issue_online,num_last_vol_online,num_last_issue_online,title_url,first_author,title_id,embargo_info,coverage_depth,coverage_notes,publisher_name,publication_type,date_monograph_published_print,date_monograph_published_online,monograph_volume,monograph_edition,first_editor,parent_publication_title_id,preceding_publication_title_id,access_type |
| 85 |
Nature Plants 2055-0278 2015-01 1 1 https://www.nature.com/nplants 4aaa7 fulltext Hybrid (Open Choice) Nature Publishing Group UK serial P |
85 |
Nature Plants,,2055-0278,2015-01,1,1,,,,https://www.nature.com/nplants,,4aaa7,,fulltext,Hybrid (Open Choice),Nature Publishing Group UK,serial,,,,,,,,P |
| 86 |
Nature Astronomy 2397-3366 2017-01 1 1 https://www.nature.com/natastron 4bbb0 fulltext Hybrid (Open Choice) Nature Publishing Group UK serial P' |
86 |
Nature Astronomy,,2397-3366,2017-01,1,1,,,,https://www.nature.com/natastron,,4bbb0,,fulltext,Hybrid (Open Choice),Nature Publishing Group UK,serial,,,,,,,,P' |
| 87 |
) |
87 |
) |
| 88 |
}; |
88 |
}; |
| 89 |
|
89 |
|
|
Lines 119-139
subtest 'create_title_hash_from_line_data' => sub {
Link Here
|
| 119 |
plan tests => 2; |
119 |
plan tests => 2; |
| 120 |
|
120 |
|
| 121 |
my $file = { |
121 |
my $file = { |
| 122 |
filename => 'Test_file.tsv', |
122 |
filename => 'Test_file.csv', |
| 123 |
file_content => encode_base64( |
123 |
file_content => encode_base64( |
| 124 |
'publication_title print_identifier online_identifier date_first_issue_online num_first_vol_online num_first_issue_online date_last_issue_online num_last_vol_online num_last_issue_online title_url first_author title_id embargo_info coverage_depth coverage_notes publisher_name publication_type date_monograph_published_print date_monograph_published_online monograph_volume monograph_edition first_editor parent_publication_title_id preceding_publication_title_id access_type |
124 |
'publication_title,print_identifier,online_identifier,date_first_issue_online,num_first_vol_online,num_first_issue_online,date_last_issue_online,num_last_vol_online,num_last_issue_online,title_url,first_author,title_id,embargo_info,coverage_depth,coverage_notes,publisher_name,publication_type,date_monograph_published_print,date_monograph_published_online,monograph_volume,monograph_edition,first_editor,parent_publication_title_id,preceding_publication_title_id,access_type |
| 125 |
Nature Plants 2055-0278 2015-01 1 1 https://www.nature.com/nplants 4aaa7 fulltext Hybrid (Open Choice) Nature Publishing Group UK serial P |
125 |
Nature Plants,,2055-0278,2015-01,1,1,,,,https://www.nature.com/nplants,,4aaa7,,fulltext,Hybrid (Open Choice),Nature Publishing Group UK,serial,,,,,,,,P |
| 126 |
Nature Astronomy 2397-3366 2017-01 1 1 https://www.nature.com/natastron 4bbb0 fulltext Hybrid (Open Choice) Nature Publishing Group UK serial P' |
126 |
Nature Astronomy,,2397-3366,2017-01,1,1,,,,https://www.nature.com/natastron,,4bbb0,,fulltext,Hybrid (Open Choice),Nature Publishing Group UK,serial,,,,,,,,P' |
| 127 |
) |
127 |
) |
| 128 |
}; |
128 |
}; |
| 129 |
|
129 |
|
| 130 |
my ( $column_headers, $lines ) = Koha::BackgroundJob::ImportKBARTFile::read_file($file); |
130 |
my ( $column_headers, $lines ) = Koha::BackgroundJob::ImportKBARTFile::read_file($file); |
| 131 |
my @invalid_columns; |
131 |
my @invalid_columns; |
| 132 |
|
132 |
|
| 133 |
my $title_from_line1 = |
133 |
my $title_from_line1 = Koha::BackgroundJob::ImportKBARTFile::create_title_hash_from_line_data( |
| 134 |
Koha::BackgroundJob::ImportKBARTFile::create_title_hash_from_line_data( @{$lines}[0], $column_headers, \@invalid_columns ); |
134 |
@{$lines}[0], $column_headers, |
| 135 |
my $title_from_line2 = |
135 |
\@invalid_columns |
| 136 |
Koha::BackgroundJob::ImportKBARTFile::create_title_hash_from_line_data( @{$lines}[1], $column_headers, \@invalid_columns ); |
136 |
); |
|
|
137 |
my $title_from_line2 = Koha::BackgroundJob::ImportKBARTFile::create_title_hash_from_line_data( |
| 138 |
@{$lines}[1], $column_headers, |
| 139 |
\@invalid_columns |
| 140 |
); |
| 137 |
|
141 |
|
| 138 |
my $line1_match = { |
142 |
my $line1_match = { |
| 139 |
'coverage_depth' => 'fulltext', |
143 |
'coverage_depth' => 'fulltext', |
|
Lines 210-219
Nature Astronomy,,2397-3366,2017-01,1,1,,,,https://www.nature.com/natastron,,4bb
Link Here
|
| 210 |
my ( $column_headers, $lines ) = Koha::BackgroundJob::ImportKBARTFile::read_file($file); |
214 |
my ( $column_headers, $lines ) = Koha::BackgroundJob::ImportKBARTFile::read_file($file); |
| 211 |
my @invalid_columns = ('invalid_column'); |
215 |
my @invalid_columns = ('invalid_column'); |
| 212 |
|
216 |
|
| 213 |
my $title_from_line1 = |
217 |
my $title_from_line1 = Koha::BackgroundJob::ImportKBARTFile::create_title_hash_from_line_data( |
| 214 |
Koha::BackgroundJob::ImportKBARTFile::create_title_hash_from_line_data( @{$lines}[0], $column_headers, \@invalid_columns ); |
218 |
@{$lines}[0], $column_headers, |
| 215 |
my $title_from_line2 = |
219 |
\@invalid_columns |
| 216 |
Koha::BackgroundJob::ImportKBARTFile::create_title_hash_from_line_data( @{$lines}[1], $column_headers, \@invalid_columns ); |
220 |
); |
|
|
221 |
my $title_from_line2 = Koha::BackgroundJob::ImportKBARTFile::create_title_hash_from_line_data( |
| 222 |
@{$lines}[1], $column_headers, |
| 223 |
\@invalid_columns |
| 224 |
); |
| 217 |
|
225 |
|
| 218 |
my $line1_match = { |
226 |
my $line1_match = { |
| 219 |
'coverage_depth' => 'fulltext', |
227 |
'coverage_depth' => 'fulltext', |
|
Lines 288-298
subtest 'process' => sub {
Link Here
|
| 288 |
); |
296 |
); |
| 289 |
|
297 |
|
| 290 |
my $file = { |
298 |
my $file = { |
| 291 |
filename => 'Test_file.tsv', |
299 |
filename => 'Test_file.csv', |
| 292 |
file_content => encode_base64( |
300 |
file_content => encode_base64( |
| 293 |
'publication_title print_identifier online_identifier date_first_issue_online num_first_vol_online num_first_issue_online date_last_issue_online num_last_vol_online num_last_issue_online title_url first_author title_id embargo_info coverage_depth coverage_notes publisher_name publication_type date_monograph_published_print date_monograph_published_online monograph_volume monograph_edition first_editor parent_publication_title_id preceding_publication_title_id access_type |
301 |
'publication_title,print_identifier,online_identifier,date_first_issue_online,num_first_vol_online,num_first_issue_online,date_last_issue_online,num_last_vol_online,num_last_issue_online,title_url,first_author,title_id,embargo_info,coverage_depth,coverage_notes,publisher_name,publication_type,date_monograph_published_print,date_monograph_published_online,monograph_volume,monograph_edition,first_editor,parent_publication_title_id,preceding_publication_title_id,access_type |
| 294 |
Nature Plants 2055-0278 2015-01 1 1 https://www.nature.com/nplants 4aaa7 fulltext Hybrid (Open Choice) Nature Publishing Group UK serial P |
302 |
Nature Plants,,2055-0278,2015-01,1,1,,,,https://www.nature.com/nplants,,4aaa7,,fulltext,Hybrid (Open Choice),Nature Publishing Group UK,serial,,,,,,,,P |
| 295 |
Nature Astronomy 2397-3366 2017-01 1 1 https://www.nature.com/natastron 4bbb0 fulltext Hybrid (Open Choice) Nature Publishing Group UK serial P' |
303 |
Nature Astronomy,,2397-3366,2017-01,1,1,,,,https://www.nature.com/natastron,,4bbb0,,fulltext,Hybrid (Open Choice),Nature Publishing Group UK,serial,,,,,,,,P' |
| 296 |
) |
304 |
) |
| 297 |
}; |
305 |
}; |
| 298 |
|
306 |
|
|
Lines 453-456
Nature Astronomy 2397-3366 2017-01 1 1 https://www.nature.com/natastron 4bb
Link Here
|
| 453 |
is( @{ $job4->messages }[1]->{code}, 'title_already_exists', 'Error message for a duplicate title' ); |
461 |
is( @{ $job4->messages }[1]->{code}, 'title_already_exists', 'Error message for a duplicate title' ); |
| 454 |
|
462 |
|
| 455 |
$schema->storage->txn_rollback; |
463 |
$schema->storage->txn_rollback; |
| 456 |
} |
464 |
} |
| 457 |
- |
|
|