Lines 100-116
is($dupkeys, 0, 'No duplicate keys');
Link Here
|
100 |
|
100 |
|
101 |
subtest "new() tests" => sub { |
101 |
subtest "new() tests" => sub { |
102 |
|
102 |
|
103 |
plan tests => 12; |
103 |
plan tests => 14; |
104 |
|
104 |
|
105 |
# Test default values with a MARC::Record record |
105 |
# Test default values with a MARC::Record record |
106 |
my $record = MARC::Record->new(); |
106 |
my $record = MARC::Record->new(); |
107 |
my $metadata_record = new Koha::MetadataRecord({ |
107 |
my $metadata_record; |
108 |
record => $record |
108 |
|
|
|
109 |
warning_is { $metadata_record = new Koha::MetadataRecord({ |
110 |
record => $record }) } |
111 |
{ carped => 'No schema passed' }, |
112 |
"Metadata schema is mandatory, raise a carped warning if omitted"; |
113 |
is( $metadata_record, undef, "Metadata schema is mandatory, return undef if omitted"); |
114 |
|
115 |
$metadata_record = new Koha::MetadataRecord({ |
116 |
record => $record, |
117 |
schema => 'marc21' |
109 |
}); |
118 |
}); |
110 |
|
119 |
|
111 |
is( ref($metadata_record), 'Koha::MetadataRecord', 'Type correct'); |
120 |
is( ref($metadata_record), 'Koha::MetadataRecord', 'Type correct'); |
112 |
is( ref($metadata_record->record), 'MARC::Record', 'Record type preserved'); |
121 |
is( ref($metadata_record->record), 'MARC::Record', 'Record type preserved'); |
113 |
is( $metadata_record->schema, 'marc21', 'Metadata schema defaults to marc21'); |
122 |
is( $metadata_record->schema, 'marc21', 'Metadata schema is set to marc21'); |
114 |
is( $metadata_record->format, 'MARC', 'Serializacion format defaults to marc'); |
123 |
is( $metadata_record->format, 'MARC', 'Serializacion format defaults to marc'); |
115 |
is( $metadata_record->id, undef, 'id is optional, undef if unspecifid'); |
124 |
is( $metadata_record->id, undef, 'id is optional, undef if unspecifid'); |
116 |
|
125 |
|
117 |
- |
|
|