Bugzilla – Attachment 144276 Details for
Bug 32350
We should die if TestBuilder is passed a column we're not expecting
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 32350: Use array_minus and ignore nesting
Bug-32350-Use-arrayminus-and-ignore-nesting.patch (text/plain), 2.24 KB, created by
Marcel de Rooy
on 2022-11-28 07:57:13 UTC
(
hide
)
Description:
Bug 32350: Use array_minus and ignore nesting
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2022-11-28 07:57:13 UTC
Size:
2.24 KB
patch
obsolete
>From 1ad8f446c99afb3fc52e108f09aea52cedf440a1 Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Fri, 25 Nov 2022 10:02:24 +0000 >Subject: [PATCH] Bug 32350: Use array_minus and ignore nesting >Content-Type: text/plain; charset=utf-8 > >Note: Test will be extended in follow-up. This fixes the >module_bit hash to follow the FK path from user_permissions >to permissions to userflags. One step was missed in the >existing test, although it did not fail. The change here >revealed that now. > >Test plan: >Run t/db_dependent/TestBuilder.t > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > t/db_dependent/TestBuilder.t | 4 +++- > t/lib/TestBuilder.pm | 5 +++++ > 2 files changed, 8 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/TestBuilder.t b/t/db_dependent/TestBuilder.t >index c256fe53fc..30588da103 100755 >--- a/t/db_dependent/TestBuilder.t >+++ b/t/db_dependent/TestBuilder.t >@@ -244,7 +244,9 @@ sub default_userpermission { > privacy => 1, > }, > module_bit => { >- flag => 'my flag', >+ module_bit => { >+ flag => 'my flag', >+ }, > }, > code => { > code => 'my code', >diff --git a/t/lib/TestBuilder.pm b/t/lib/TestBuilder.pm >index d065835ded..95699392c6 100644 >--- a/t/lib/TestBuilder.pm >+++ b/t/lib/TestBuilder.pm >@@ -12,6 +12,7 @@ use Bytes::Random::Secure; > use Carp qw( carp ); > use Module::Load qw( load ); > use String::Random; >+use Array::Utils qw( array_minus ); > > use constant { > SIZE_BARCODE => 20, # Not perfect but avoid to fetch the value when creating a new item >@@ -280,6 +281,10 @@ sub _buildColumnValues { > my @columns = $self->schema->source($source)->columns; > my %unique_constraints = $self->schema->source($source)->unique_constraints(); > >+ my @passed_keys = grep { ref($original_value->{$_}) ne 'HASH' } keys %$original_value; >+ my @minus = array_minus( @passed_keys, @columns ); >+ die "Error: value hash contains unrecognized columns: ". (join ',', @minus) if @minus; >+ > my $build_value = 5; > # we try max $build_value times if there are unique constraints > BUILD_VALUE: while ( $build_value ) { >-- >2.30.2
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 32350
:
144229
|
144230
|
144233
|
144234
|
144235
|
144239
|
144245
|
144246
|
144247
|
144248
|
144276
|
144277
|
144349
|
144350