Bugzilla – Attachment 58155 Details for
Bug 17726
TestBuilder's refactoring removed default values
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 17726: TestBuilder - Add default values
Bug-17726-TestBuilder---Add-default-values.patch (text/plain), 2.84 KB, created by
Marcel de Rooy
on 2016-12-13 13:14:16 UTC
(
hide
)
Description:
Bug 17726: TestBuilder - Add default values
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2016-12-13 13:14:16 UTC
Size:
2.84 KB
patch
obsolete
>From 1b57cf5afdf89d2a11b73f400bddee05d9f5e42a Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Mon, 12 Dec 2016 22:38:40 +0000 >Subject: [PATCH] Bug 17726: TestBuilder - Add default values >Content-Type: text/plain; charset=utf-8 > >The items.more_subfields_xml is set to random data (generated by >TestBuilder), and so GetMarcBiblio does not manage to embed items (if >needed). > >The error is: > :1: parser error : Start tag expected, '<' not found > >More precisely it explodes in >C4::Items::_parse_unlinked_item_subfields_from_xml when >MARC::Record->new_from_xml is called with an invalid xml > >This patch adds a default values mechanism to TestBuilder to avoid >modifying all the existing calls. > >Test plan: >Set SearchEngine to ElasticSearch >prove t/db_dependent/Circulation.pl >should return green with this patch > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >--- > t/db_dependent/TestBuilder.t | 11 ++++++++++- > t/lib/TestBuilder.pm | 15 +++++++++++++++ > 2 files changed, 25 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/TestBuilder.t b/t/db_dependent/TestBuilder.t >index 3046ad8..4d93cee 100644 >--- a/t/db_dependent/TestBuilder.t >+++ b/t/db_dependent/TestBuilder.t >@@ -19,7 +19,7 @@ > > use Modern::Perl; > >-use Test::More tests => 10; >+use Test::More tests => 11; > use Test::Warn; > use Data::Dumper qw(Dumper); > >@@ -332,6 +332,15 @@ subtest 'Date handling' => sub { > > }; > >+subtest 'Default values' => sub { >+ plan tests => 2; >+ $builder = t::lib::TestBuilder->new; >+ my $item = $builder->build( { source => 'Item' } ); >+ is( $item->{more_subfields_xml}, undef ); >+ $item = $builder->build( { source => 'Item', value => { more_subfields_xml => 'some xml' } } ); >+ is( $item->{more_subfields_xml}, 'some xml' ); >+}; >+ > $schema->storage->txn_rollback; > > 1; >diff --git a/t/lib/TestBuilder.pm b/t/lib/TestBuilder.pm >index 666cc87..0d312d0 100644 >--- a/t/lib/TestBuilder.pm >+++ b/t/lib/TestBuilder.pm >@@ -13,6 +13,7 @@ sub new { > $self->schema->storage->sql_maker->quote_char('`'); > > $self->{gen_type} = _gen_type(); >+ $self->{default_values} = _gen_default_values(); > return $self; > } > >@@ -290,6 +291,8 @@ sub _buildColumnValue { > return; > } > push @$retvalue, $value->{$col_name}; >+ } elsif( exists $self->{default_values}{$source}{$col_name} ) { >+ push @$retvalue, $self->{default_values}{$source}{$col_name}; > } else { > my $data_type = $col_info->{data_type}; > $data_type =~ s| |_|; >@@ -414,6 +417,18 @@ sub _gen_blob { > return 'b'; > } > >+sub _gen_default_values { >+ my ($self) = @_; >+ return { >+ Item => { >+ more_subfields_xml => undef, >+ }, >+ Biblioitem => { >+ marcxml => undef, >+ } >+ }; >+} >+ > =head1 NAME > > t::lib::TestBuilder.pm - Koha module to create test records >-- >2.1.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 17726
:
58152
| 58155 |
58156
|
59300
|
59341
|
59353