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

(-)a/t/db_dependent/Koha/Item.t (-19 / +2 lines)
Lines 322-328 subtest "as_marc_field() tests" => sub { Link Here
322
    my @schema_columns = $schema->resultset('Item')->result_source->columns;
322
    my @schema_columns = $schema->resultset('Item')->result_source->columns;
323
    my @mapped_columns = grep { exists $mss->{'items.'.$_} } @schema_columns;
323
    my @mapped_columns = grep { exists $mss->{'items.'.$_} } @schema_columns;
324
324
325
    plan tests => 2 * (scalar @mapped_columns + 1) + 4;
325
    plan tests => scalar @mapped_columns + 5;
326
326
327
    $schema->storage->txn_begin;
327
    $schema->storage->txn_begin;
328
328
Lines 330-352 subtest "as_marc_field() tests" => sub { Link Here
330
    # Make sure it has at least one undefined attribute
330
    # Make sure it has at least one undefined attribute
331
    $item->set({ replacementprice => undef })->store->discard_changes;
331
    $item->set({ replacementprice => undef })->store->discard_changes;
332
332
333
    # Tests with the mss parameter
333
    my $marc_field = $item->as_marc_field;
334
    my $marc_field = $item->as_marc_field({ mss => $mss });
335
336
    is(
337
        $marc_field->tag,
338
        $itemtag,
339
        'Generated field set the right tag number'
340
    );
341
342
    foreach my $column ( @mapped_columns ) {
343
        my $tagsubfield = $mss->{ 'items.' . $column }[0]->{tagsubfield};
344
        is( $marc_field->subfield($tagsubfield),
345
            $item->$column, "Value is mapped correctly for column $column" );
346
    }
347
348
    # Tests without the mss parameter
349
    $marc_field = $item->as_marc_field();
350
334
351
    is(
335
    is(
352
        $marc_field->tag,
336
        $marc_field->tag,
353
- 

Return to bug 32464