| Line 0
          
      
      
        Link Here | 
          
            
              | 0 | -  | 1 | #!/usr/bin/perl | 
            
              |  |  | 2 |  | 
            
              | 3 | use Modern::Perl; | 
            
              | 4 | use Test::More tests => 24; | 
            
              | 5 | use Data::Dumper; | 
            
              | 6 |  | 
            
              | 7 | BEGIN { | 
            
              | 8 |     use_ok('C4::Biblio'); | 
            
              | 9 | } | 
            
              | 10 |  | 
            
              | 11 | my @columns = qw( | 
            
              | 12 |     tagfield tagsubfield liblibrarian libopac repeatable mandatory kohafield tab | 
            
              | 13 |     authorised_value authtypecode value_builder isurl hidden frameworkcode | 
            
              | 14 |     seealso link defaultvalue maxlength | 
            
              | 15 | ); | 
            
              | 16 |  | 
            
              | 17 | # biblio.biblionumber must be mapped so this should return something | 
            
              | 18 | my $marc_subfield_structure = GetMarcSubfieldStructureFromKohaField('biblio.biblionumber', ''); | 
            
              | 19 |  | 
            
              | 20 | ok(defined $marc_subfield_structure, "There is a result"); | 
            
              | 21 | is(ref $marc_subfield_structure, "HASH", "Result is a hashref"); | 
            
              | 22 | foreach my $col (@columns) { | 
            
              | 23 |     ok(exists $marc_subfield_structure->{$col}, "Hashref contains key '$col'"); | 
            
              | 24 | } | 
            
              | 25 | is($marc_subfield_structure->{kohafield}, 'biblio.biblionumber', "Result is the good result"); | 
            
              | 26 | like($marc_subfield_structure->{tagfield}, qr/^\d{3}$/, "tagfield is a valid tagfield"); | 
            
              | 27 |  | 
            
              | 28 | # foo.bar does not exist so this should return undef | 
            
              | 29 | $marc_subfield_structure = GetMarcSubfieldStructureFromKohaField('foo.bar', ''); | 
            
              | 30 | is($marc_subfield_structure, undef, "invalid kohafield returns undef"); |