Bug 21749: Add tests for ImportFramework
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
(cherry picked from commit cbb90000fd)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
This commit is contained in:
parent
121ba294c4
commit
9e46509487
|
|
@ -0,0 +1,34 @@
|
|||
#!/usr/bin/perl
|
||||
|
||||
use Modern::Perl;
|
||||
use Test::More tests => 3;
|
||||
use File::Basename qw( dirname );
|
||||
|
||||
use Koha::Database;
|
||||
use Koha::BiblioFrameworks;
|
||||
use Koha::MarcSubfieldStructures;
|
||||
use t::lib::TestBuilder;
|
||||
use C4::ImportExportFramework;
|
||||
|
||||
my $schema = Koha::Database->new->schema;
|
||||
$schema->storage->txn_begin;
|
||||
my $builder = t::lib::TestBuilder->new;
|
||||
|
||||
my $data_filepath = dirname(__FILE__) . '/data/biblio_framework.csv';
|
||||
|
||||
my $frameworkcode = '4T';
|
||||
C4::ImportExportFramework::ImportFramework($data_filepath, $frameworkcode);
|
||||
|
||||
my $dbh = C4::Context->dbh;
|
||||
|
||||
# FIXME Import does not create the biblio framework
|
||||
#my $biblio_framework = Koha::BiblioFrameworks->find($frameworkcode);
|
||||
#ok( $biblio_framework );
|
||||
|
||||
my $nb_tags = $dbh->selectrow_array(q|SELECT COUNT(*) FROM marc_tag_structure WHERE frameworkcode="4T"|);
|
||||
is( $nb_tags, 4, "4 tags should have been imported" );
|
||||
|
||||
my $nb_subfields =
|
||||
Koha::MarcSubfieldStructures->search( { frameworkcode => $frameworkcode } )
|
||||
->count;
|
||||
is( $nb_subfields, 12, "12 subfields should have been imported" );
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
"tagfield","liblibrarian","libopac","repeatable","mandatory","authorised_value","frameworkcode"
|
||||
"000","LEADER","LEADER","0","1","",""
|
||||
"001","CONTROL NUMBER","CONTROL NUMBER","0","0","",""
|
||||
"003","CONTROL NUMBER IDENTIFIER","CONTROL NUMBER IDENTIFIER","0","1","",""
|
||||
"010","LIBRARY OF CONGRESS CONTROL NUMBER","LIBRARY OF CONGRESS CONTROL NUMBER","0","0","",""
|
||||
|
||||
"#-#","#-#","#-#","#-#","#-#","#-#","#-#"
|
||||
|
||||
"tagfield","tagsubfield","liblibrarian","libopac","repeatable","mandatory","kohafield","tab","authorised_value","authtypecode","value_builder","isurl","hidden","frameworkcode","seealso","link","defaultvalue","maxlength"
|
||||
"000","@","fixed length control field","fixed length control field","0","1","","0","","","marc21_leader.pl","0","0","","","","","24"
|
||||
"001","@","control field","control field","0","0","","0","","","","0","0","","","","","9999"
|
||||
"003","@","control field","control field","0","1","","0","","","marc21_orgcode.pl","0","0","","","","","9999"
|
||||
"005","@","control field","control field","0","1","","0","","","marc21_field_005.pl","0","0","","","","","9999"
|
||||
"006","@","fixed length control field","fixed length control field","0","0","","0","","","marc21_field_006.pl","0","-1","","","","","9999"
|
||||
"007","@","fixed length control field","fixed length control field","0","0","","0","","","marc21_field_007.pl","0","0","","","","","9999"
|
||||
"008","@","fixed length control field","fixed length control field","0","1","","0","","","marc21_field_008.pl","0","0","","","","","40"
|
||||
"009","@","fixed length control field","fixed length control field","0","0","","0","","","","0","-6","","","","","9999"
|
||||
"010","8","Field link and sequence number","Field link and sequence number","1","0","","0","","","","0","-6","","","","","9999"
|
||||
"010","a","LC control number","LC control number","0","0","biblioitems.lccn","0","","","","0","0","","","","","9999"
|
||||
"010","b","NUCMC control number","NUCMC control number","1","0","","0","","","","0","-1","","","","","9999"
|
||||
"010","z","Canceled/invalid LC control number","Canceled/invalid LC control number","1","0","","0","","","","0","-1","","","","","9999"
|
||||
|
||||
"#-#","#-#","#-#","#-#","#-#","#-#","#-#","#-#","#-#","#-#","#-#","#-#","#-#","#-#","#-#","#-#","#-#","#-#"
|
||||
|
Can't render this file because it has a wrong number of fields in line 9.
|
Loading…
Reference in New Issue