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

(-)a/t/db_dependent/ImportExportFramework.t (-2 / +35 lines)
Lines 36-44 subtest 'ImportFramework() tests' => sub { Link Here
36
    plan tests => 3;
36
    plan tests => 3;
37
37
38
    subtest 'CSV tests' => sub {
38
    subtest 'CSV tests' => sub {
39
        plan tests => 9;
39
        plan tests => 15;
40
40
41
        run_tests('csv');
41
        run_tests('csv');
42
43
        run_csv_no_quoted();
42
    };
44
    };
43
45
44
    subtest 'ODS tests' => sub {
46
    subtest 'ODS tests' => sub {
Lines 97-100 sub run_tests { Link Here
97
    is( $nb_subfields, 8, "8 subfields should have been imported" );
99
    is( $nb_subfields, 8, "8 subfields should have been imported" );
98
100
99
    $schema->storage->txn_rollback;
101
    $schema->storage->txn_rollback;
100
}
102
};
103
104
sub run_csv_no_quoted {
105
106
    $schema->storage->txn_begin;
107
108
    my $data_filepath = dirname(__FILE__) . "/data/frameworks/biblio_framework_no_quoted.csv";
109
    my $fw_1 = $builder->build_object({ class => 'Koha::BiblioFrameworks' });
110
111
    my $result = C4::ImportExportFramework::ImportFramework( $data_filepath, $fw_1->id );
112
    is( $result, 0, 'Import successful, no tags removed' );
113
114
    my $nb_tags = $schema->resultset('MarcTagStructure')->search({ frameworkcode => $fw_1->id })->count;
115
    is( $nb_tags, 4, "4 tags should have been imported" );
116
117
    my $nb_subfields = Koha::MarcSubfieldStructures->search({ frameworkcode => $fw_1->id })->count;
118
    is( $nb_subfields, 12, "12 subfields should have been imported" );
119
120
    # bad file tests
121
    my $fw_2 = $builder->build_object({ class => 'Koha::BiblioFrameworks' });
122
    $result = C4::ImportExportFramework::ImportFramework( '', $fw_2->id );
123
124
    is( $result, -1, 'Bad file makes it return -1' );
125
126
    $nb_tags = $schema->resultset('MarcTagStructure')->search({ frameworkcode => $fw_2->id })->count;
127
    is( $nb_tags, 0, "0 tags should have been imported" );
128
129
    $nb_subfields = Koha::MarcSubfieldStructures->search({ frameworkcode => $fw_2->id })->count;
130
    is( $nb_subfields, 0, "0 subfields should have been imported" );
131
132
    $schema->storage->txn_rollback;
133
};
(-)a/t/db_dependent/data/frameworks/biblio_framework_no_quoted.csv (-1 / +23 lines)
Line 0 Link Here
0
- 
1
"tagfield","liblibrarian","libopac","repeatable","mandatory","important","authorised_value","ind1_defaultvalue","ind2_defaultvalue","frameworkcode",,,,,,,,,
2
"000","LEADER","LEADER","0","1","0",,,,,,,,,,,,,
3
"001","CONTROL NUMBER","CONTROL NUMBER","0","0","0",,,,,,,,,,,,,
4
"003","CONTROL NUMBER IDENTIFIER","CONTROL NUMBER IDENTIFIER","0","1","0",,,,,,,,,,,,,
5
"010","LIBRARY OF CONGRESS CONTROL NUMBER","LIBRARY OF CONGRESS CONTROL NUMBER","0","0","0",,,,,,,,,,,,,
6
,,,,,,,,,,,,,,,,,,
7
"#-#","#-#","#-#","#-#","#-#","#-#","#-#"
8
,,,,,,,,,,,,,,,,,,
9
"tagfield","tagsubfield","liblibrarian","libopac","repeatable","mandatory","important","kohafield","tab","authorised_value","authtypecode","value_builder","isurl","hidden","frameworkcode","seealso","link","defaultvalue","maxlength"
10
"000","@","fixed length control field","fixed length control field","0","1","0",,"0",,,"marc21_leader.pl","0","0",,,,,"24"
11
"001","@","control field","control field","0","0","0",,"0",,,,"0","0",,,,,"9999"
12
"003","@","control field","control field","0","1","0",,"0",,,"marc21_orgcode.pl","0","0",,,,,"9999"
13
"005","@","control field","control field","0","1","0",,"0",,,"marc21_field_005.pl","0","0",,,,,"9999"
14
"006","@","fixed length control field","fixed length control field","0","0","0",,"0",,,"marc21_field_006.pl","0","-1",,,,,"9999"
15
"007","@","fixed length control field","fixed length control field","0","0","0",,"0",,,"marc21_field_007.pl","0","0",,,,,"9999"
16
"008","@","fixed length control field","fixed length control field","0","1","0",,"0",,,"marc21_field_008.pl","0","0",,,,,"40"
17
"009","@","fixed length control field","fixed length control field","0","0","0",,"0",,,,"0","-6",,,,,"9999"
18
"010","8","Field link and sequence number","Field link and sequence number","1","0","0",,"0",,,,"0","-6",,,,,"9999"
19
"010","a","LC control number","LC control number","0","0","0","biblioitems.lccn","0",,,,"0","0",,,,,"9999"
20
"010","b","NUCMC control number","NUCMC control number","1","0","0",,"0",,,,"0","-1",,,,,"9999"
21
"010","z","Canceled/invalid LC control number","Canceled/invalid LC control number","1","0","0",,"0",,,,"0","-1",,,,,"9999"
22
,,,,,,,,,,,,,,,,,,
23
"#-#","#-#","#-#","#-#","#-#","#-#","#-#","#-#","#-#","#-#","#-#","#-#","#-#","#-#","#-#","#-#","#-#","#-#"

Return to bug 27569