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

(-)a/t/db_dependent/TestBuilder.t (-1 / +10 lines)
Lines 19-25 Link Here
19
19
20
use Modern::Perl;
20
use Modern::Perl;
21
21
22
use Test::More tests => 10;
22
use Test::More tests => 11;
23
use Test::Warn;
23
use Test::Warn;
24
use Data::Dumper qw(Dumper);
24
use Data::Dumper qw(Dumper);
25
25
Lines 332-337 subtest 'Date handling' => sub { Link Here
332
332
333
};
333
};
334
334
335
subtest 'Default values' => sub {
336
    plan tests => 2;
337
    $builder = t::lib::TestBuilder->new;
338
    my $item = $builder->build( { source => 'Item' } );
339
    is( $item->{more_subfields_xml}, undef );
340
    $item = $builder->build( { source => 'Item', value => { more_subfields_xml => 'some xml' } } );
341
    is( $item->{more_subfields_xml}, 'some xml' );
342
};
343
335
$schema->storage->txn_rollback;
344
$schema->storage->txn_rollback;
336
345
337
1;
346
1;
(-)a/t/lib/TestBuilder.pm (-1 / +15 lines)
Lines 13-18 sub new { Link Here
13
    $self->schema->storage->sql_maker->quote_char('`');
13
    $self->schema->storage->sql_maker->quote_char('`');
14
14
15
    $self->{gen_type} = _gen_type();
15
    $self->{gen_type} = _gen_type();
16
    $self->{default_values} = _gen_default_values();
16
    return $self;
17
    return $self;
17
}
18
}
18
19
Lines 290-295 sub _buildColumnValue { Link Here
290
            return;
291
            return;
291
        }
292
        }
292
        push @$retvalue, $value->{$col_name};
293
        push @$retvalue, $value->{$col_name};
294
    } elsif( exists $self->{default_values}{$source}{$col_name} ) {
295
        push @$retvalue, $self->{default_values}{$source}{$col_name};
293
    } else {
296
    } else {
294
        my $data_type = $col_info->{data_type};
297
        my $data_type = $col_info->{data_type};
295
        $data_type =~ s| |_|;
298
        $data_type =~ s| |_|;
Lines 414-419 sub _gen_blob { Link Here
414
    return 'b';
417
    return 'b';
415
}
418
}
416
419
420
sub _gen_default_values {
421
    my ($self) = @_;
422
    return {
423
        Item => {
424
            more_subfields_xml => undef,
425
        },
426
        Biblioitem => {
427
            marcxml => undef,
428
        }
429
    };
430
}
431
417
=head1 NAME
432
=head1 NAME
418
433
419
t::lib::TestBuilder.pm - Koha module to create test records
434
t::lib::TestBuilder.pm - Koha module to create test records
420
- 

Return to bug 17726