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

(-)a/t/db_dependent/Koha/Item.t (-19 / +2 lines)
Lines 362-368 subtest "as_marc_field() tests" => sub { Link Here
362
    my @schema_columns = $schema->resultset('Item')->result_source->columns;
362
    my @schema_columns = $schema->resultset('Item')->result_source->columns;
363
    my @mapped_columns = grep { exists $mss->{'items.'.$_} } @schema_columns;
363
    my @mapped_columns = grep { exists $mss->{'items.'.$_} } @schema_columns;
364
364
365
    plan tests => 2 * (scalar @mapped_columns + 1) + 4;
365
    plan tests => scalar @mapped_columns + 5;
366
366
367
    $schema->storage->txn_begin;
367
    $schema->storage->txn_begin;
368
368
Lines 370-392 subtest "as_marc_field() tests" => sub { Link Here
370
    # Make sure it has at least one undefined attribute
370
    # Make sure it has at least one undefined attribute
371
    $item->set({ replacementprice => undef })->store->discard_changes;
371
    $item->set({ replacementprice => undef })->store->discard_changes;
372
372
373
    # Tests with the mss parameter
373
    my $marc_field = $item->as_marc_field;
374
    my $marc_field = $item->as_marc_field({ mss => $mss });
375
376
    is(
377
        $marc_field->tag,
378
        $itemtag,
379
        'Generated field set the right tag number'
380
    );
381
382
    foreach my $column ( @mapped_columns ) {
383
        my $tagsubfield = $mss->{ 'items.' . $column }[0]->{tagsubfield};
384
        is( $marc_field->subfield($tagsubfield),
385
            $item->$column, "Value is mapped correctly for column $column" );
386
    }
387
388
    # Tests without the mss parameter
389
    $marc_field = $item->as_marc_field();
390
374
391
    is(
375
    is(
392
        $marc_field->tag,
376
        $marc_field->tag,
393
- 

Return to bug 32464