From 3eec0e96ecac50c560640b4525f12adaf36b7122 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Thu, 6 Dec 2012 10:08:23 +0100 Subject: [PATCH] Bug 7919: Fix unit test (Members_AttributeTypes.t) - Reintroduce the class column in a select statement (was present before this development) - FIX UT: If there are no arg passed in parameter, the routine calls C4::Context->userenv which call an execute statement. It consumes the mocked resultset Signed-off-by: Chris Cormack Signed-off-by: Elliott Davis All tests successful. Files=1, Tests=9, 0 wallclock secs ( 0.02 usr 0.01 sys + 0.16 cusr 0.06 csys = 0.25 CPU) Result: PASS --- C4/Members/AttributeTypes.pm | 2 +- t/Members_AttributeTypes.t | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/C4/Members/AttributeTypes.pm b/C4/Members/AttributeTypes.pm index ac4153e8a9..17540997f4 100644 --- a/C4/Members/AttributeTypes.pm +++ b/C4/Members/AttributeTypes.pm @@ -74,7 +74,7 @@ sub GetAttributeTypes { my $branch_limit = $no_branch_limit ? 0 : C4::Context->userenv ? C4::Context->userenv->{"branch"} : 0; - my $select = $all ? '*' : 'DISTINCT(code), description'; + my $select = $all ? '*' : 'DISTINCT(code), description, class'; my $dbh = C4::Context->dbh; my $query = "SELECT $select FROM borrower_attribute_types"; diff --git a/t/Members_AttributeTypes.t b/t/Members_AttributeTypes.t index 5aba165566..152fc5340d 100755 --- a/t/Members_AttributeTypes.t +++ b/t/Members_AttributeTypes.t @@ -37,7 +37,7 @@ my $dbh = C4::Context->dbh(); $dbh->{mock_add_resultset} = $members_attributetypes; -my @members_attributetypes = C4::Members::AttributeTypes::GetAttributeTypes(); +my @members_attributetypes = C4::Members::AttributeTypes::GetAttributeTypes(undef, 1); is( $members_attributetypes[0]->{'code'}, 'one', 'First code value is one' ); -- 2.39.5