View | Details | Raw Unified | Return to bug 16504
Collapse All | Expand All

(-)a/t/db_dependent/Members/Attributes.t (-2 / +33 lines)
Lines 25-31 use C4::Members::AttributeTypes; Link Here
25
use Koha::Database;
25
use Koha::Database;
26
use t::lib::TestBuilder;
26
use t::lib::TestBuilder;
27
27
28
use Test::More tests => 53;
28
use Test::More tests => 55;
29
29
30
use_ok('C4::Members::Attributes');
30
use_ok('C4::Members::Attributes');
31
31
Lines 220-222 is( $borrower_attributes->[0]->{value}, $attributes->[1]->{value}, 'DeleteBorrow Link Here
220
C4::Members::Attributes::DeleteBorrowerAttribute($borrowernumber, $attributes->[1]);
220
C4::Members::Attributes::DeleteBorrowerAttribute($borrowernumber, $attributes->[1]);
221
$borrower_attributes = C4::Members::Attributes::GetBorrowerAttributes($borrowernumber);
221
$borrower_attributes = C4::Members::Attributes::GetBorrowerAttributes($borrowernumber);
222
is( @$borrower_attributes, 1, 'DeleteBorrowerAttribute deletes a borrower attribute' );
222
is( @$borrower_attributes, 1, 'DeleteBorrowerAttribute deletes a borrower attribute' );
223
- 
223
224
# Regression tests for bug 16504
225
C4::Context->set_userenv(123, 'userid', 'usercnum', 'First name', 'Surname', $new_library->{branchcode}, 'My Library', 0);
226
my $another_patron = $builder->build(
227
    {   source => 'Borrower',
228
        value  => {
229
            firstname    => 'my another firstname',
230
            surname      => 'my another surname',
231
            categorycode => 'S',
232
            branchcode => $new_library->{branchcode},
233
        }
234
    }
235
);
236
$attributes = [
237
    {
238
        value => 'my attribute1',
239
        code => $attribute_type1->code(),
240
    },
241
    {
242
        value => 'my attribute2',
243
        code => $attribute_type2->code(),
244
    },
245
    {
246
        value => 'my attribute limited',
247
        code => $attribute_type_limited->code(),
248
    }
249
];
250
C4::Members::Attributes::SetBorrowerAttributes($another_patron->{borrowernumber}, $attributes);
251
$borrower_attributes = C4::Members::Attributes::GetBorrowerAttributes($another_patron->{borrowernumber});
252
is( @$borrower_attributes, 3, 'SetBorrowerAttributes should have added the 3 attributes for another patron');
253
$borrower_attributes = C4::Members::Attributes::GetBorrowerAttributes($borrowernumber);
254
is( @$borrower_attributes, 1, 'SetBorrowerAttributes should not have removed the attributes of other patrons' );

Return to bug 16504