Lines 4-15
Link Here
|
4 |
# This needs to be extended! Your help is appreciated.. |
4 |
# This needs to be extended! Your help is appreciated.. |
5 |
|
5 |
|
6 |
use Modern::Perl; |
6 |
use Modern::Perl; |
7 |
use Test::More tests => 3; |
7 |
use Test::More tests => 4; |
8 |
|
8 |
|
9 |
use Koha::Database; |
9 |
use Koha::Database; |
10 |
use t::lib::TestBuilder; |
10 |
use t::lib::TestBuilder; |
11 |
use t::lib::Mocks; |
11 |
use t::lib::Mocks; |
12 |
use C4::SIP::ILS::Patron; |
12 |
use C4::SIP::ILS::Patron; |
|
|
13 |
use Koha::Patron::Attributes; |
13 |
|
14 |
|
14 |
my $schema = Koha::Database->new->schema; |
15 |
my $schema = Koha::Database->new->schema; |
15 |
$schema->storage->txn_begin; |
16 |
$schema->storage->txn_begin; |
Lines 72-75
subtest "OverduesBlockCirc tests" => sub {
Link Here
|
72 |
|
73 |
|
73 |
}; |
74 |
}; |
74 |
|
75 |
|
|
|
76 |
subtest "Test build_patron_attribute_string" => sub { |
77 |
|
78 |
plan tests => 2; |
79 |
|
80 |
my $patron = $builder->build( { source => 'Borrower' } ); |
81 |
|
82 |
my $attribute_type = $builder->build( { source => 'BorrowerAttributeType' } ); |
83 |
my $attribute = Koha::Patron::Attribute->new( |
84 |
{ |
85 |
borrowernumber => $patron->{borrowernumber}, |
86 |
code => $attribute_type->{code}, |
87 |
attribute => 'Test Attribute' |
88 |
} |
89 |
)->store(); |
90 |
|
91 |
my $attribute_type2 = $builder->build( { source => 'BorrowerAttributeType' } ); |
92 |
my $attribute2 = Koha::Patron::Attribute->new( |
93 |
{ |
94 |
borrowernumber => $patron->{borrowernumber}, |
95 |
code => $attribute_type2->{code}, |
96 |
attribute => 'Another Test Attribute' |
97 |
} |
98 |
)->store(); |
99 |
|
100 |
my $ils_patron = C4::SIP::ILS::Patron->new( $patron->{cardnumber} ); |
101 |
|
102 |
my $server = {}; |
103 |
$server->{account}->{patron_attribute}->{code} = $attribute->code; |
104 |
$server->{account}->{patron_attribute}->{field} = 'XY'; |
105 |
my $attribute_string = $ils_patron->build_patron_attributes_string( $server ); |
106 |
is( $attribute_string, "XYTest Attribute|", 'Attribute field generated correctly with single param' ); |
107 |
|
108 |
$server = {}; |
109 |
$server->{account}->{patron_attribute}->[0]->{code} = $attribute->code; |
110 |
$server->{account}->{patron_attribute}->[0]->{field} = 'XY'; |
111 |
$server->{account}->{patron_attribute}->[1]->{code} = $attribute2->code; |
112 |
$server->{account}->{patron_attribute}->[1]->{field} = 'YZ'; |
113 |
$attribute_string = $ils_patron->build_patron_attributes_string( $server ); |
114 |
is( $attribute_string, "XYTest Attribute|YZAnother Test Attribute|", 'Attribute field generated correctly with multiple params' ); |
115 |
}; |
116 |
|
75 |
$schema->storage->txn_rollback; |
117 |
$schema->storage->txn_rollback; |
76 |
- |
|
|