From c7d0ff1dfc8c0209905a5180992aa257fe44d305 Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Thu, 26 May 2016 21:56:50 +0200 Subject: [PATCH] Bug 16500: [QA Follow-up] Catch warning if branch MPL already exists Content-Type: text/plain; charset=utf-8 The current test had no warnings, when you have no MPL branch, and only catches the warn from the second build on line 57. If you do have MPL, a warning comes from line 56. This patch quickly fixes it. Report 16607 will propose a general solution. Test plan: Do not yet apply the patch. Add MPL branch. Run the test. Notice the warning about Branch. Apply the patch. Run the test. Warning gone? Signed-off-by: Marcel de Rooy --- t/db_dependent/TestBuilder.t | 2 ++ 1 file changed, 2 insertions(+) diff --git a/t/db_dependent/TestBuilder.t b/t/db_dependent/TestBuilder.t index 724f32d..95f986a 100644 --- a/t/db_dependent/TestBuilder.t +++ b/t/db_dependent/TestBuilder.t @@ -53,7 +53,9 @@ subtest 'Start with some trivial tests' => sub { # return undef if a record exists my $param = { source => 'Branch', value => { branchcode => 'MPL' } }; + local $SIG{__WARN__} = sub {}; $builder->build( $param ); # at least it should exist now + delete local $SIG{__WARN__}; warning_like { $builder->build( $param ) } qr/Violation of unique constraint/, 'Catch warn on adding existing record'; -- 1.7.10.4