X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=dbsrgits%2FDBIx-Class.git;a=blobdiff_plain;f=t%2Fresultset%2Fupdate_delete.t;h=05d245bd9c1bcc4a99ef057889983e1b9d14aa6a;hp=fc535e627aa5c773ff09c9dadeaba88884376c3c;hb=af668ad64b95ab8d84343a4738a7ce65e068f3f3;hpb=10176e1f9feac3f33603fd385a301c9d94de59fc diff --git a/t/resultset/update_delete.t b/t/resultset/update_delete.t index fc535e6..05d245b 100644 --- a/t/resultset/update_delete.t +++ b/t/resultset/update_delete.t @@ -79,8 +79,12 @@ throws_ok ( ); # grouping on PKs only should pass -$sub_rs->search ({}, { group_by => [ reverse $sub_rs->result_source->primary_columns ] }) # reverse to make sure the comaprison works - ->update ({ pilot_sequence => \ 'pilot_sequence + 1' }); +$sub_rs->search ( + {}, + { + group_by => [ reverse $sub_rs->result_source->primary_columns ], # reverse to make sure the PK-list comaprison works + }, +)->update ({ pilot_sequence => \ 'pilot_sequence + 1' }); is_deeply ( [ $tkfks->search ({ autopilot => [qw/a b x y/]}, { order_by => 'autopilot' }) @@ -90,6 +94,19 @@ is_deeply ( 'Only two rows incremented', ); +# also make sure weird scalarref usage works (RT#51409) +$tkfks->search ( + \ 'pilot_sequence BETWEEN 11 AND 21', +)->update ({ pilot_sequence => \ 'pilot_sequence + 1' }); + +is_deeply ( + [ $tkfks->search ({ autopilot => [qw/a b x y/]}, { order_by => 'autopilot' }) + ->get_column ('pilot_sequence')->all + ], + [qw/12 22 30 40/], + 'Only two rows incremented (where => scalarref works)', +); + $sub_rs->delete; is ($tkfks->count, $tkfk_cnt -= 2, 'Only two rows deleted');