Bugzilla – Attachment 144349 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.26 KB, created by
Tomás Cohen Arazi (tcohen)
on 2022-11-30 15:48:47 UTC
(
hide
)
Description:
Bug 32350: Use array_minus and ignore nesting
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2022-11-30 15:48:47 UTC
Size:
2.26 KB
patch
obsolete
>From 9b9b8f19200695df168440d47cecc6b947fcebc5 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 > >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> >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > 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 c256fe53fc1..30588da103a 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 d065835ded0..95699392c6a 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.34.1
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