Lines 44-52
subtest 'ImportFramework() tests' => sub {
Link Here
|
44 |
}; |
44 |
}; |
45 |
|
45 |
|
46 |
subtest 'ODS tests' => sub { |
46 |
subtest 'ODS tests' => sub { |
47 |
plan tests => 9; |
47 |
plan tests => 15; |
48 |
|
48 |
|
49 |
run_tests('ods'); |
49 |
run_tests('ods'); |
|
|
50 |
|
51 |
run_ods_new(); |
50 |
}; |
52 |
}; |
51 |
|
53 |
|
52 |
subtest 'XML tests' => sub { |
54 |
subtest 'XML tests' => sub { |
Lines 131-133
sub run_csv_no_quoted {
Link Here
|
131 |
|
133 |
|
132 |
$schema->storage->txn_rollback; |
134 |
$schema->storage->txn_rollback; |
133 |
}; |
135 |
}; |
|
|
136 |
|
137 |
sub run_ods_new { |
138 |
|
139 |
my ($format) = @_; |
140 |
|
141 |
$schema->storage->txn_begin; |
142 |
|
143 |
my $data_filepath = dirname(__FILE__) . "/data/frameworks/biblio_framework_new.ods"; |
144 |
my $fw_1 = $builder->build_object({ class => 'Koha::BiblioFrameworks' }); |
145 |
|
146 |
my $result = C4::ImportExportFramework::ImportFramework( $data_filepath, $fw_1->id ); |
147 |
is( $result, 0, 'Import successful, no tags removed' ); |
148 |
|
149 |
my $nb_tags = $schema->resultset('MarcTagStructure')->search({ frameworkcode => $fw_1->id })->count; |
150 |
is( $nb_tags, 5, "5 tags should have been imported" ); |
151 |
|
152 |
my $nb_subfields = Koha::MarcSubfieldStructures->search({ frameworkcode => $fw_1->id })->count; |
153 |
is( $nb_subfields, 16, "16 subfields should have been imported" ); |
154 |
|
155 |
# bad file tests |
156 |
my $fw_2 = $builder->build_object({ class => 'Koha::BiblioFrameworks' }); |
157 |
$result = C4::ImportExportFramework::ImportFramework( '', $fw_2->id ); |
158 |
|
159 |
is( $result, -1, 'Bad file makes it return -1' ); |
160 |
|
161 |
$nb_tags = $schema->resultset('MarcTagStructure')->search({ frameworkcode => $fw_2->id })->count; |
162 |
is( $nb_tags, 0, "0 tags should have been imported" ); |
163 |
|
164 |
$nb_subfields = Koha::MarcSubfieldStructures->search({ frameworkcode => $fw_2->id })->count; |
165 |
is( $nb_subfields, 0, "0 subfields should have been imported" ); |
166 |
|
167 |
|
168 |
$schema->storage->txn_rollback; |
169 |
}; |