Lines 17-316
Link Here
|
17 |
|
17 |
|
18 |
use Modern::Perl; |
18 |
use Modern::Perl; |
19 |
|
19 |
|
20 |
use Test::More; |
20 |
use Test::More tests => 3; |
21 |
use Test::Warn; |
21 |
use Test::Warn; |
22 |
use t::lib::Mocks; |
22 |
use t::lib::Mocks; |
|
|
23 |
use t::lib::TestBuilder; |
23 |
|
24 |
|
24 |
use Module::Load::Conditional qw/check_install/; |
25 |
use_ok('Koha::Object'); |
|
|
26 |
use_ok('Koha::Patron'); |
25 |
|
27 |
|
26 |
BEGIN { |
28 |
use Koha::Database; |
27 |
if ( check_install( module => 'Test::DBIx::Class' ) ) { |
|
|
28 |
plan tests => 11; |
29 |
} else { |
30 |
plan skip_all => "Need Test::DBIx::Class" |
31 |
} |
32 |
use_ok('Koha::Object'); |
33 |
use_ok('Koha::Patron'); |
34 |
} |
35 |
|
29 |
|
36 |
use Test::DBIx::Class; |
30 |
my $schema = Koha::Database->new->schema; |
37 |
my $db = Test::MockModule->new('Koha::Database'); |
31 |
my $builder = t::lib::TestBuilder->new; |
38 |
$db->mock( _new_schema => sub { return Schema(); } ); |
|
|
39 |
|
32 |
|
40 |
my $object = Koha::Patron->new( { surname => 'Test Patron' } ); |
33 |
subtest 'Accessor tests' => sub { |
41 |
is( $object->surname(), 'Test Patron', "Accessor returns correct value" ); |
34 |
plan tests => 9; |
42 |
$object->surname('Test Patron Surname'); |
35 |
$schema->storage->txn_begin; |
43 |
is( $object->surname(), 'Test Patron Surname', "Accessor returns correct value after set" ); |
|
|
44 |
|
45 |
my $object2 = Koha::Patron->new( { surname => 'Test Patron 2' } ); |
46 |
is( $object2->surname(), 'Test Patron 2', "Accessor returns correct value" ); |
47 |
$object2->surname('Test Patron Surname 2'); |
48 |
is( $object2->surname(), 'Test Patron Surname 2', "Accessor returns correct value after set" ); |
49 |
|
36 |
|
50 |
my $ret; |
37 |
my $object = Koha::Patron->new( { surname => 'Test Patron' } ); |
51 |
$ret = $object2->set( { surname => "Test Patron Surname 3", firstname => "Test Firstname" } ); |
38 |
is( $object->surname(), 'Test Patron', "Accessor returns correct value" ); |
52 |
ok( ref($ret) eq 'Koha::Patron', "Set returns object on success" ); |
39 |
$object->surname('Test Patron Surname'); |
53 |
is( $object2->surname(), "Test Patron Surname 3", "Set sets first field correctly" ); |
40 |
is( $object->surname(), 'Test Patron Surname', "Accessor returns correct value after set" ); |
54 |
is( $object2->firstname(), "Test Firstname", "Set sets second field correctly" ); |
|
|
55 |
|
41 |
|
56 |
my $patron = Koha::Patron->new( |
42 |
my $object2 = Koha::Patron->new( { surname => 'Test Patron 2' } ); |
57 |
{ |
43 |
is( $object2->surname(), 'Test Patron 2', "Accessor returns correct value" ); |
58 |
borrowernumber => '12345', |
44 |
$object2->surname('Test Patron Surname 2'); |
59 |
cardnumber => '1234567890', |
45 |
is( $object2->surname(), 'Test Patron Surname 2', "Accessor returns correct value after set" ); |
60 |
surname => 'mySurname', |
|
|
61 |
firstname => 'myFirstname', |
62 |
title => 'Mr.', |
63 |
othernames => 'myOthernames', |
64 |
initials => 'MM', |
65 |
streetnumber => '100', |
66 |
streettype => 'Blvd', |
67 |
address => 'my personnal address', |
68 |
address2 => 'my adress2', |
69 |
city => 'Marseille', |
70 |
state => 'mystate', |
71 |
zipcode => '13006', |
72 |
country => 'France', |
73 |
email => 'mySurname.myFirstname@email.com', |
74 |
phone => '0402872934', |
75 |
mobile => '0627884632', |
76 |
fax => '0402872935', |
77 |
emailpro => 'myEmailPro@email.com', |
78 |
phonepro => '0402873334', |
79 |
B_streetnumber => '101', |
80 |
B_streettype => 'myB_streettype', |
81 |
B_address => 'myB_address', |
82 |
B_address2 => 'myB_address2', |
83 |
B_city => 'myB_city', |
84 |
B_state => 'myB_state', |
85 |
B_zipcode => '23456', |
86 |
B_country => 'myB_country', |
87 |
B_email => 'myB_email', |
88 |
B_phone => '0678353935', |
89 |
dateofbirth => '1990-07-16', |
90 |
branchcode => 'myBranCode', |
91 |
categorycode => 'myCatCode', |
92 |
dateenrolled => '2015-03-19', |
93 |
dateexpiry => '2016-03-19', |
94 |
gonenoaddress => '0', |
95 |
lost => '0', |
96 |
debarred => '2015-04-19', |
97 |
debarredcomment => 'You are debarred', |
98 |
borrowernotes => 'borrowernotes', |
99 |
sex => 'M', |
100 |
password => 'hfkurhfe976634èj!', |
101 |
flags => '55555', |
102 |
userid => '87987', |
103 |
opacnote => 'myOpacnote', |
104 |
contactnote => 'myContactnote', |
105 |
sort1 => 'mySort1', |
106 |
sort2 => 'mySort2', |
107 |
altcontactfirstname => 'myAltcontactfirstname', |
108 |
altcontactsurname => 'myAltcontactsurname', |
109 |
altcontactaddress1 => 'myAltcontactaddress1', |
110 |
altcontactaddress2 => 'myAltcontactaddress2', |
111 |
altcontactaddress3 => 'myAltcontactaddress3', |
112 |
altcontactstate => 'myAltcontactstate', |
113 |
altcontactzipcode => '465843', |
114 |
altcontactcountry => 'myOtherCountry', |
115 |
altcontactphone => 'myOtherphone', |
116 |
smsalertnumber => '0683027346', |
117 |
privacy => '667788', |
118 |
} |
119 |
); |
120 |
|
46 |
|
121 |
# patron Accessor tests |
47 |
my $ret; |
122 |
subtest 'Accessor tests' => sub { |
48 |
$ret = $object2->set( { surname => "Test Patron Surname 3", firstname => "Test Firstname" } ); |
123 |
plan tests => 60; |
49 |
ok( ref($ret) eq 'Koha::Patron', "Set returns object on success" ); |
124 |
is( $patron->borrowernumber, '12345', 'borrowernumber accessor returns correct value' ); |
50 |
is( $object2->surname(), "Test Patron Surname 3", "Set sets first field correctly" ); |
125 |
is( $patron->cardnumber, '1234567890', 'cardnumber accessor returns correct value' ); |
51 |
is( $object2->firstname(), "Test Firstname", "Set sets second field correctly" ); |
126 |
is( $patron->surname, 'mySurname', 'surname accessor returns correct value' ); |
|
|
127 |
is( $patron->firstname, 'myFirstname', 'firstname accessor returns correct value' ); |
128 |
is( $patron->title, 'Mr.', 'title accessor returns correct value' ); |
129 |
is( $patron->othernames, 'myOthernames', 'othernames accessor returns correct value' ); |
130 |
is( $patron->initials, 'MM', 'initials accessor returns correct value' ); |
131 |
is( $patron->streetnumber, '100', 'streetnumber accessor returns correct value' ); |
132 |
is( $patron->streettype, 'Blvd', 'streettype accessor returns correct value' ); |
133 |
is( $patron->address, 'my personnal address', 'address accessor returns correct value' ); |
134 |
is( $patron->address2, 'my adress2', 'address2 accessor returns correct value' ); |
135 |
is( $patron->city, 'Marseille', 'city accessor returns correct value' ); |
136 |
is( $patron->state, 'mystate', 'state accessor returns correct value' ); |
137 |
is( $patron->zipcode, '13006', 'zipcode accessor returns correct value' ); |
138 |
is( $patron->country, 'France', 'country accessor returns correct value' ); |
139 |
is( $patron->email, 'mySurname.myFirstname@email.com', 'email accessor returns correct value' ); |
140 |
is( $patron->phone, '0402872934', 'phone accessor returns correct value' ); |
141 |
is( $patron->mobile, '0627884632', 'mobile accessor returns correct value' ); |
142 |
is( $patron->fax, '0402872935', 'fax accessor returns correct value' ); |
143 |
is( $patron->emailpro, 'myEmailPro@email.com', 'emailpro accessor returns correct value' ); |
144 |
is( $patron->phonepro, '0402873334', 'phonepro accessor returns correct value' ); |
145 |
is( $patron->B_streetnumber, '101', 'B_streetnumber accessor returns correct value' ); |
146 |
is( $patron->B_streettype, 'myB_streettype', 'B_streettype accessor returns correct value' ); |
147 |
is( $patron->B_address, 'myB_address', 'B_address accessor returns correct value' ); |
148 |
is( $patron->B_address2, 'myB_address2', 'B_address2 accessor returns correct value' ); |
149 |
is( $patron->B_city, 'myB_city', 'B_city accessor returns correct value' ); |
150 |
is( $patron->B_state, 'myB_state', 'B_state accessor returns correct value' ); |
151 |
is( $patron->B_zipcode, '23456', 'B_zipcode accessor returns correct value' ); |
152 |
is( $patron->B_country, 'myB_country', 'B_country accessor returns correct value' ); |
153 |
is( $patron->B_email, 'myB_email', 'B_email accessor returns correct value' ); |
154 |
is( $patron->B_phone, '0678353935', 'B_phone accessor returns correct value' ); |
155 |
is( $patron->dateofbirth, '1990-07-16', 'dateofbirth accessor returns correct value' ); |
156 |
is( $patron->branchcode, 'myBranCode', 'branchcode accessor returns correct value' ); |
157 |
is( $patron->categorycode, 'myCatCode', 'categorycode accessor returns correct value' ); |
158 |
is( $patron->dateenrolled, '2015-03-19', 'dateenrolled accessor returns correct value' ); |
159 |
is( $patron->dateexpiry, '2016-03-19', 'dateexpiry accessor returns correct value' ); |
160 |
is( $patron->gonenoaddress, '0', 'gonenoaddress accessor returns correct value' ); |
161 |
is( $patron->lost, '0', 'lost accessor returns correct value' ); |
162 |
is( $patron->debarred, '2015-04-19', 'debarred accessor returns correct value' ); |
163 |
is( $patron->debarredcomment, 'You are debarred', 'debarredcomment accessor returns correct value' ); |
164 |
is( $patron->borrowernotes, 'borrowernotes', 'borrowernotes accessor returns correct value' ); |
165 |
is( $patron->sex, 'M', 'sex accessor returns correct value' ); |
166 |
is( $patron->password, 'hfkurhfe976634èj!', 'password accessor returns correct value' ); |
167 |
is( $patron->flags, '55555', 'flags accessor returns correct value' ); |
168 |
is( $patron->userid, '87987', 'userid accessor returns correct value' ); |
169 |
is( $patron->opacnote, 'myOpacnote', 'opacnote accessor returns correct value' ); |
170 |
is( $patron->contactnote, 'myContactnote', 'contactnote accessor returns correct value' ); |
171 |
is( $patron->sort1, 'mySort1', 'sort1 accessor returns correct value' ); |
172 |
is( $patron->sort2, 'mySort2', 'sort2 accessor returns correct value' ); |
173 |
is( $patron->altcontactfirstname, 'myAltcontactfirstname', 'altcontactfirstname accessor returns correct value' ); |
174 |
is( $patron->altcontactsurname, 'myAltcontactsurname', 'altcontactsurname accessor returns correct value' ); |
175 |
is( $patron->altcontactaddress1, 'myAltcontactaddress1', 'altcontactaddress1 accessor returns correct value' ); |
176 |
is( $patron->altcontactaddress2, 'myAltcontactaddress2', 'altcontactaddress2 accessor returns correct value' ); |
177 |
is( $patron->altcontactaddress3, 'myAltcontactaddress3', 'altcontactaddress3 accessor returns correct value' ); |
178 |
is( $patron->altcontactstate, 'myAltcontactstate', 'altcontactstate accessor returns correct value' ); |
179 |
is( $patron->altcontactzipcode, '465843', 'altcontactzipcode accessor returns correct value' ); |
180 |
is( $patron->altcontactcountry, 'myOtherCountry', 'altcontactcountry accessor returns correct value' ); |
181 |
is( $patron->altcontactphone, 'myOtherphone', 'altcontactphone accessor returns correct value' ); |
182 |
is( $patron->smsalertnumber, '0683027346', 'smsalertnumber accessor returns correct value' ); |
183 |
is( $patron->privacy, '667788', 'privacy accessor returns correct value' ); |
184 |
}; |
185 |
|
52 |
|
186 |
# patron Set tests |
53 |
our $patron = Koha::Patron->new( |
187 |
subtest 'Set tests' => sub { |
|
|
188 |
plan tests => 60; |
189 |
|
190 |
$patron->set( |
191 |
{ |
54 |
{ |
192 |
borrowernumber => '12346', |
55 |
borrowernumber => '12345', |
193 |
cardnumber => '1234567891', |
56 |
cardnumber => '1234567890', |
194 |
surname => 'SmySurname', |
57 |
surname => 'mySurname', |
195 |
firstname => 'SmyFirstname', |
58 |
firstname => 'myFirstname', |
196 |
title => 'Mme.', |
59 |
title => 'Mr.', |
197 |
othernames => 'SmyOthernames', |
60 |
othernames => 'myOthernames', |
198 |
initials => 'SS', |
61 |
initials => 'MM', |
199 |
streetnumber => '200', |
62 |
streetnumber => '100', |
200 |
streettype => 'Rue', |
63 |
streettype => 'Blvd', |
201 |
address => 'Smy personnal address', |
64 |
address => 'my personnal address', |
202 |
address2 => 'Smy adress2', |
65 |
address2 => 'my adress2', |
203 |
city => 'Lyon', |
66 |
city => 'Marseille', |
204 |
state => 'Smystate', |
67 |
state => 'mystate', |
205 |
zipcode => '69000', |
68 |
zipcode => '13006', |
206 |
country => 'France', |
69 |
country => 'France', |
207 |
email => 'SmySurname.myFirstname@email.com', |
70 |
email => 'mySurname.myFirstname@email.com', |
208 |
phone => '0402872935', |
71 |
phone => '0402872934', |
209 |
mobile => '0627884633', |
72 |
mobile => '0627884632', |
210 |
fax => '0402872936', |
73 |
fax => '0402872935', |
211 |
emailpro => 'SmyEmailPro@email.com', |
74 |
emailpro => 'myEmailPro@email.com', |
212 |
phonepro => '0402873335', |
75 |
phonepro => '0402873334', |
213 |
B_streetnumber => '102', |
76 |
B_streetnumber => '101', |
214 |
B_streettype => 'SmyB_streettype', |
77 |
B_streettype => 'myB_streettype', |
215 |
B_address => 'SmyB_address', |
78 |
B_address => 'myB_address', |
216 |
B_address2 => 'SmyB_address2', |
79 |
B_address2 => 'myB_address2', |
217 |
B_city => 'SmyB_city', |
80 |
B_city => 'myB_city', |
218 |
B_state => 'SmyB_state', |
81 |
B_state => 'myB_state', |
219 |
B_zipcode => '12333', |
82 |
B_zipcode => '23456', |
220 |
B_country => 'SmyB_country', |
83 |
B_country => 'myB_country', |
221 |
B_email => 'SmyB_email', |
84 |
B_email => 'myB_email', |
222 |
B_phone => '0678353936', |
85 |
B_phone => '0678353935', |
223 |
dateofbirth => '1991-07-16', |
86 |
dateofbirth => '1990-07-16', |
224 |
branchcode => 'SmyBranCode', |
87 |
branchcode => 'myBranCode', |
225 |
categorycode => 'SmyCatCode', |
88 |
categorycode => 'myCatCode', |
226 |
dateenrolled => '2014-03-19', |
89 |
dateenrolled => '2015-03-19', |
227 |
dateexpiry => '2017-03-19', |
90 |
dateexpiry => '2016-03-19', |
228 |
gonenoaddress => '1', |
91 |
gonenoaddress => '0', |
229 |
lost => '1', |
92 |
lost => '0', |
230 |
debarred => '2016-04-19', |
93 |
debarred => '2015-04-19', |
231 |
debarredcomment => 'You are still debarred', |
94 |
debarredcomment => 'You are debarred', |
232 |
borrowernotes => 'Sborrowernotes', |
95 |
borrowernotes => 'borrowernotes', |
233 |
sex => 'F', |
96 |
sex => 'M', |
234 |
password => 'zerzerzer#', |
97 |
password => 'hfkurhfe976634èj!', |
235 |
flags => '666666', |
98 |
flags => '55555', |
236 |
userid => '98233', |
99 |
userid => '87987', |
237 |
opacnote => 'SmyOpacnote', |
100 |
opacnote => 'myOpacnote', |
238 |
contactnote => 'SmyContactnote', |
101 |
contactnote => 'myContactnote', |
239 |
sort1 => 'SmySort1', |
102 |
sort1 => 'mySort1', |
240 |
sort2 => 'SmySort2', |
103 |
sort2 => 'mySort2', |
241 |
altcontactfirstname => 'SmyAltcontactfirstname', |
104 |
altcontactfirstname => 'myAltcontactfirstname', |
242 |
altcontactsurname => 'SmyAltcontactsurname', |
105 |
altcontactsurname => 'myAltcontactsurname', |
243 |
altcontactaddress1 => 'SmyAltcontactaddress1', |
106 |
altcontactaddress1 => 'myAltcontactaddress1', |
244 |
altcontactaddress2 => 'SmyAltcontactaddress2', |
107 |
altcontactaddress2 => 'myAltcontactaddress2', |
245 |
altcontactaddress3 => 'SmyAltcontactaddress3', |
108 |
altcontactaddress3 => 'myAltcontactaddress3', |
246 |
altcontactstate => 'SmyAltcontactstate', |
109 |
altcontactstate => 'myAltcontactstate', |
247 |
altcontactzipcode => '565843', |
110 |
altcontactzipcode => '465843', |
248 |
altcontactcountry => 'SmyOtherCountry', |
111 |
altcontactcountry => 'myOtherCountry', |
249 |
altcontactphone => 'SmyOtherphone', |
112 |
altcontactphone => 'myOtherphone', |
250 |
smsalertnumber => '0683027347', |
113 |
smsalertnumber => '0683027346', |
251 |
privacy => '667789' |
114 |
privacy => '667788', |
252 |
} |
115 |
} |
253 |
); |
116 |
); |
254 |
|
117 |
|
255 |
is( $patron->borrowernumber, '12346', 'borrowernumber field set ok' ); |
118 |
subtest 'Accessor tests after new' => sub { |
256 |
is( $patron->cardnumber, '1234567891', 'cardnumber field set ok' ); |
119 |
plan tests => 60; |
257 |
is( $patron->surname, 'SmySurname', 'surname field set ok' ); |
120 |
is( $patron->borrowernumber, '12345', 'borrowernumber accessor returns correct value' ); |
258 |
is( $patron->firstname, 'SmyFirstname', 'firstname field set ok' ); |
121 |
is( $patron->cardnumber, '1234567890', 'cardnumber accessor returns correct value' ); |
259 |
is( $patron->title, 'Mme.', 'title field set ok' ); |
122 |
is( $patron->surname, 'mySurname', 'surname accessor returns correct value' ); |
260 |
is( $patron->othernames, 'SmyOthernames', 'othernames field set ok' ); |
123 |
is( $patron->firstname, 'myFirstname', 'firstname accessor returns correct value' ); |
261 |
is( $patron->initials, 'SS', 'initials field set ok' ); |
124 |
is( $patron->title, 'Mr.', 'title accessor returns correct value' ); |
262 |
is( $patron->streetnumber, '200', 'streetnumber field set ok' ); |
125 |
is( $patron->othernames, 'myOthernames', 'othernames accessor returns correct value' ); |
263 |
is( $patron->streettype, 'Rue', 'streettype field set ok' ); |
126 |
is( $patron->initials, 'MM', 'initials accessor returns correct value' ); |
264 |
is( $patron->address, 'Smy personnal address', 'address field set ok' ); |
127 |
is( $patron->streetnumber, '100', 'streetnumber accessor returns correct value' ); |
265 |
is( $patron->address2, 'Smy adress2', 'address2 field set ok' ); |
128 |
is( $patron->streettype, 'Blvd', 'streettype accessor returns correct value' ); |
266 |
is( $patron->city, 'Lyon', 'city field set ok' ); |
129 |
is( $patron->address, 'my personnal address', 'address accessor returns correct value' ); |
267 |
is( $patron->state, 'Smystate', 'state field set ok' ); |
130 |
is( $patron->address2, 'my adress2', 'address2 accessor returns correct value' ); |
268 |
is( $patron->zipcode, '69000', 'zipcode field set ok' ); |
131 |
is( $patron->city, 'Marseille', 'city accessor returns correct value' ); |
269 |
is( $patron->country, 'France', 'country field set ok' ); |
132 |
is( $patron->state, 'mystate', 'state accessor returns correct value' ); |
270 |
is( $patron->email, 'SmySurname.myFirstname@email.com', 'email field set ok' ); |
133 |
is( $patron->zipcode, '13006', 'zipcode accessor returns correct value' ); |
271 |
is( $patron->phone, '0402872935', 'phone field set ok' ); |
134 |
is( $patron->country, 'France', 'country accessor returns correct value' ); |
272 |
is( $patron->mobile, '0627884633', 'mobile field set ok' ); |
135 |
is( $patron->email, 'mySurname.myFirstname@email.com', 'email accessor returns correct value' ); |
273 |
is( $patron->fax, '0402872936', 'fax field set ok' ); |
136 |
is( $patron->phone, '0402872934', 'phone accessor returns correct value' ); |
274 |
is( $patron->emailpro, 'SmyEmailPro@email.com', 'emailpro field set ok' ); |
137 |
is( $patron->mobile, '0627884632', 'mobile accessor returns correct value' ); |
275 |
is( $patron->phonepro, '0402873335', 'phonepro field set ok' ); |
138 |
is( $patron->fax, '0402872935', 'fax accessor returns correct value' ); |
276 |
is( $patron->B_streetnumber, '102', 'B_streetnumber field set ok' ); |
139 |
is( $patron->emailpro, 'myEmailPro@email.com', 'emailpro accessor returns correct value' ); |
277 |
is( $patron->B_streettype, 'SmyB_streettype', 'B_streettype field set ok' ); |
140 |
is( $patron->phonepro, '0402873334', 'phonepro accessor returns correct value' ); |
278 |
is( $patron->B_address, 'SmyB_address', 'B_address field set ok' ); |
141 |
is( $patron->B_streetnumber, '101', 'B_streetnumber accessor returns correct value' ); |
279 |
is( $patron->B_address2, 'SmyB_address2', 'B_address2 field set ok' ); |
142 |
is( $patron->B_streettype, 'myB_streettype', 'B_streettype accessor returns correct value' ); |
280 |
is( $patron->B_city, 'SmyB_city', 'B_city field set ok' ); |
143 |
is( $patron->B_address, 'myB_address', 'B_address accessor returns correct value' ); |
281 |
is( $patron->B_state, 'SmyB_state', 'B_state field set ok' ); |
144 |
is( $patron->B_address2, 'myB_address2', 'B_address2 accessor returns correct value' ); |
282 |
is( $patron->B_zipcode, '12333', 'B_zipcode field set ok' ); |
145 |
is( $patron->B_city, 'myB_city', 'B_city accessor returns correct value' ); |
283 |
is( $patron->B_country, 'SmyB_country', 'B_country field set ok' ); |
146 |
is( $patron->B_state, 'myB_state', 'B_state accessor returns correct value' ); |
284 |
is( $patron->B_email, 'SmyB_email', 'B_email field set ok' ); |
147 |
is( $patron->B_zipcode, '23456', 'B_zipcode accessor returns correct value' ); |
285 |
is( $patron->B_phone, '0678353936', 'B_phone field set ok' ); |
148 |
is( $patron->B_country, 'myB_country', 'B_country accessor returns correct value' ); |
286 |
is( $patron->dateofbirth, '1991-07-16', 'dateofbirth field set ok' ); |
149 |
is( $patron->B_email, 'myB_email', 'B_email accessor returns correct value' ); |
287 |
is( $patron->branchcode, 'SmyBranCode', 'branchcode field set ok' ); |
150 |
is( $patron->B_phone, '0678353935', 'B_phone accessor returns correct value' ); |
288 |
is( $patron->categorycode, 'SmyCatCode', 'categorycode field set ok' ); |
151 |
is( $patron->dateofbirth, '1990-07-16', 'dateofbirth accessor returns correct value' ); |
289 |
is( $patron->dateenrolled, '2014-03-19', 'dateenrolled field set ok' ); |
152 |
is( $patron->branchcode, 'myBranCode', 'branchcode accessor returns correct value' ); |
290 |
is( $patron->dateexpiry, '2017-03-19', 'dateexpiry field set ok' ); |
153 |
is( $patron->categorycode, 'myCatCode', 'categorycode accessor returns correct value' ); |
291 |
is( $patron->gonenoaddress, '1', 'gonenoaddress field set ok' ); |
154 |
is( $patron->dateenrolled, '2015-03-19', 'dateenrolled accessor returns correct value' ); |
292 |
is( $patron->lost, '1', 'lost field set ok' ); |
155 |
is( $patron->dateexpiry, '2016-03-19', 'dateexpiry accessor returns correct value' ); |
293 |
is( $patron->debarred, '2016-04-19', 'debarred field set ok' ); |
156 |
is( $patron->gonenoaddress, '0', 'gonenoaddress accessor returns correct value' ); |
294 |
is( $patron->debarredcomment, 'You are still debarred', 'debarredcomment field set ok' ); |
157 |
is( $patron->lost, '0', 'lost accessor returns correct value' ); |
295 |
is( $patron->borrowernotes, 'Sborrowernotes', 'borrowernotes field set ok' ); |
158 |
is( $patron->debarred, '2015-04-19', 'debarred accessor returns correct value' ); |
296 |
is( $patron->sex, 'F', 'sex field set ok' ); |
159 |
is( $patron->debarredcomment, 'You are debarred', 'debarredcomment accessor returns correct value' ); |
297 |
is( $patron->password, 'zerzerzer#', 'password field set ok' ); |
160 |
is( $patron->borrowernotes, 'borrowernotes', 'borrowernotes accessor returns correct value' ); |
298 |
is( $patron->flags, '666666', 'flags field set ok' ); |
161 |
is( $patron->sex, 'M', 'sex accessor returns correct value' ); |
299 |
is( $patron->userid, '98233', 'userid field set ok' ); |
162 |
is( $patron->password, 'hfkurhfe976634èj!', 'password accessor returns correct value' ); |
300 |
is( $patron->opacnote, 'SmyOpacnote', 'opacnote field set ok' ); |
163 |
is( $patron->flags, '55555', 'flags accessor returns correct value' ); |
301 |
is( $patron->contactnote, 'SmyContactnote', 'contactnote field set ok' ); |
164 |
is( $patron->userid, '87987', 'userid accessor returns correct value' ); |
302 |
is( $patron->sort1, 'SmySort1', 'sort1 field set ok' ); |
165 |
is( $patron->opacnote, 'myOpacnote', 'opacnote accessor returns correct value' ); |
303 |
is( $patron->sort2, 'SmySort2', 'sort2 field set ok' ); |
166 |
is( $patron->contactnote, 'myContactnote', 'contactnote accessor returns correct value' ); |
304 |
is( $patron->altcontactfirstname, 'SmyAltcontactfirstname', 'altcontactfirstname field set ok' ); |
167 |
is( $patron->sort1, 'mySort1', 'sort1 accessor returns correct value' ); |
305 |
is( $patron->altcontactsurname, 'SmyAltcontactsurname', 'altcontactsurname field set ok' ); |
168 |
is( $patron->sort2, 'mySort2', 'sort2 accessor returns correct value' ); |
306 |
is( $patron->altcontactaddress1, 'SmyAltcontactaddress1', 'altcontactaddress1 field set ok' ); |
169 |
is( $patron->altcontactfirstname, 'myAltcontactfirstname', 'altcontactfirstname accessor returns correct value' ); |
307 |
is( $patron->altcontactaddress2, 'SmyAltcontactaddress2', 'altcontactaddress2 field set ok' ); |
170 |
is( $patron->altcontactsurname, 'myAltcontactsurname', 'altcontactsurname accessor returns correct value' ); |
308 |
is( $patron->altcontactaddress3, 'SmyAltcontactaddress3', 'altcontactaddress3 field set ok' ); |
171 |
is( $patron->altcontactaddress1, 'myAltcontactaddress1', 'altcontactaddress1 accessor returns correct value' ); |
309 |
is( $patron->altcontactstate, 'SmyAltcontactstate', 'altcontactstate field set ok' ); |
172 |
is( $patron->altcontactaddress2, 'myAltcontactaddress2', 'altcontactaddress2 accessor returns correct value' ); |
310 |
is( $patron->altcontactzipcode, '565843', 'altcontactzipcode field set ok' ); |
173 |
is( $patron->altcontactaddress3, 'myAltcontactaddress3', 'altcontactaddress3 accessor returns correct value' ); |
311 |
is( $patron->altcontactcountry, 'SmyOtherCountry', 'altcontactcountry field set ok' ); |
174 |
is( $patron->altcontactstate, 'myAltcontactstate', 'altcontactstate accessor returns correct value' ); |
312 |
is( $patron->altcontactphone, 'SmyOtherphone', 'altcontactphone field set ok' ); |
175 |
is( $patron->altcontactzipcode, '465843', 'altcontactzipcode accessor returns correct value' ); |
313 |
is( $patron->smsalertnumber, '0683027347', 'smsalertnumber field set ok' ); |
176 |
is( $patron->altcontactcountry, 'myOtherCountry', 'altcontactcountry accessor returns correct value' ); |
314 |
is( $patron->privacy, '667789', 'privacy field set ok' ); |
177 |
is( $patron->altcontactphone, 'myOtherphone', 'altcontactphone accessor returns correct value' ); |
315 |
}; |
178 |
is( $patron->smsalertnumber, '0683027346', 'smsalertnumber accessor returns correct value' ); |
|
|
179 |
is( $patron->privacy, '667788', 'privacy accessor returns correct value' ); |
180 |
}; |
181 |
|
182 |
subtest 'Accessor tests after set' => sub { |
183 |
plan tests => 60; |
184 |
|
185 |
$patron->set( |
186 |
{ |
187 |
borrowernumber => '12346', |
188 |
cardnumber => '1234567891', |
189 |
surname => 'SmySurname', |
190 |
firstname => 'SmyFirstname', |
191 |
title => 'Mme.', |
192 |
othernames => 'SmyOthernames', |
193 |
initials => 'SS', |
194 |
streetnumber => '200', |
195 |
streettype => 'Rue', |
196 |
address => 'Smy personnal address', |
197 |
address2 => 'Smy adress2', |
198 |
city => 'Lyon', |
199 |
state => 'Smystate', |
200 |
zipcode => '69000', |
201 |
country => 'France', |
202 |
email => 'SmySurname.myFirstname@email.com', |
203 |
phone => '0402872935', |
204 |
mobile => '0627884633', |
205 |
fax => '0402872936', |
206 |
emailpro => 'SmyEmailPro@email.com', |
207 |
phonepro => '0402873335', |
208 |
B_streetnumber => '102', |
209 |
B_streettype => 'SmyB_streettype', |
210 |
B_address => 'SmyB_address', |
211 |
B_address2 => 'SmyB_address2', |
212 |
B_city => 'SmyB_city', |
213 |
B_state => 'SmyB_state', |
214 |
B_zipcode => '12333', |
215 |
B_country => 'SmyB_country', |
216 |
B_email => 'SmyB_email', |
217 |
B_phone => '0678353936', |
218 |
dateofbirth => '1991-07-16', |
219 |
branchcode => 'SmyBranCode', |
220 |
categorycode => 'SmyCatCode', |
221 |
dateenrolled => '2014-03-19', |
222 |
dateexpiry => '2017-03-19', |
223 |
gonenoaddress => '1', |
224 |
lost => '1', |
225 |
debarred => '2016-04-19', |
226 |
debarredcomment => 'You are still debarred', |
227 |
borrowernotes => 'Sborrowernotes', |
228 |
sex => 'F', |
229 |
password => 'zerzerzer#', |
230 |
flags => '666666', |
231 |
userid => '98233', |
232 |
opacnote => 'SmyOpacnote', |
233 |
contactnote => 'SmyContactnote', |
234 |
sort1 => 'SmySort1', |
235 |
sort2 => 'SmySort2', |
236 |
altcontactfirstname => 'SmyAltcontactfirstname', |
237 |
altcontactsurname => 'SmyAltcontactsurname', |
238 |
altcontactaddress1 => 'SmyAltcontactaddress1', |
239 |
altcontactaddress2 => 'SmyAltcontactaddress2', |
240 |
altcontactaddress3 => 'SmyAltcontactaddress3', |
241 |
altcontactstate => 'SmyAltcontactstate', |
242 |
altcontactzipcode => '565843', |
243 |
altcontactcountry => 'SmyOtherCountry', |
244 |
altcontactphone => 'SmyOtherphone', |
245 |
smsalertnumber => '0683027347', |
246 |
privacy => '667789' |
247 |
} |
248 |
); |
249 |
|
250 |
is( $patron->borrowernumber, '12346', 'borrowernumber field set ok' ); |
251 |
is( $patron->cardnumber, '1234567891', 'cardnumber field set ok' ); |
252 |
is( $patron->surname, 'SmySurname', 'surname field set ok' ); |
253 |
is( $patron->firstname, 'SmyFirstname', 'firstname field set ok' ); |
254 |
is( $patron->title, 'Mme.', 'title field set ok' ); |
255 |
is( $patron->othernames, 'SmyOthernames', 'othernames field set ok' ); |
256 |
is( $patron->initials, 'SS', 'initials field set ok' ); |
257 |
is( $patron->streetnumber, '200', 'streetnumber field set ok' ); |
258 |
is( $patron->streettype, 'Rue', 'streettype field set ok' ); |
259 |
is( $patron->address, 'Smy personnal address', 'address field set ok' ); |
260 |
is( $patron->address2, 'Smy adress2', 'address2 field set ok' ); |
261 |
is( $patron->city, 'Lyon', 'city field set ok' ); |
262 |
is( $patron->state, 'Smystate', 'state field set ok' ); |
263 |
is( $patron->zipcode, '69000', 'zipcode field set ok' ); |
264 |
is( $patron->country, 'France', 'country field set ok' ); |
265 |
is( $patron->email, 'SmySurname.myFirstname@email.com', 'email field set ok' ); |
266 |
is( $patron->phone, '0402872935', 'phone field set ok' ); |
267 |
is( $patron->mobile, '0627884633', 'mobile field set ok' ); |
268 |
is( $patron->fax, '0402872936', 'fax field set ok' ); |
269 |
is( $patron->emailpro, 'SmyEmailPro@email.com', 'emailpro field set ok' ); |
270 |
is( $patron->phonepro, '0402873335', 'phonepro field set ok' ); |
271 |
is( $patron->B_streetnumber, '102', 'B_streetnumber field set ok' ); |
272 |
is( $patron->B_streettype, 'SmyB_streettype', 'B_streettype field set ok' ); |
273 |
is( $patron->B_address, 'SmyB_address', 'B_address field set ok' ); |
274 |
is( $patron->B_address2, 'SmyB_address2', 'B_address2 field set ok' ); |
275 |
is( $patron->B_city, 'SmyB_city', 'B_city field set ok' ); |
276 |
is( $patron->B_state, 'SmyB_state', 'B_state field set ok' ); |
277 |
is( $patron->B_zipcode, '12333', 'B_zipcode field set ok' ); |
278 |
is( $patron->B_country, 'SmyB_country', 'B_country field set ok' ); |
279 |
is( $patron->B_email, 'SmyB_email', 'B_email field set ok' ); |
280 |
is( $patron->B_phone, '0678353936', 'B_phone field set ok' ); |
281 |
is( $patron->dateofbirth, '1991-07-16', 'dateofbirth field set ok' ); |
282 |
is( $patron->branchcode, 'SmyBranCode', 'branchcode field set ok' ); |
283 |
is( $patron->categorycode, 'SmyCatCode', 'categorycode field set ok' ); |
284 |
is( $patron->dateenrolled, '2014-03-19', 'dateenrolled field set ok' ); |
285 |
is( $patron->dateexpiry, '2017-03-19', 'dateexpiry field set ok' ); |
286 |
is( $patron->gonenoaddress, '1', 'gonenoaddress field set ok' ); |
287 |
is( $patron->lost, '1', 'lost field set ok' ); |
288 |
is( $patron->debarred, '2016-04-19', 'debarred field set ok' ); |
289 |
is( $patron->debarredcomment, 'You are still debarred', 'debarredcomment field set ok' ); |
290 |
is( $patron->borrowernotes, 'Sborrowernotes', 'borrowernotes field set ok' ); |
291 |
is( $patron->sex, 'F', 'sex field set ok' ); |
292 |
is( $patron->password, 'zerzerzer#', 'password field set ok' ); |
293 |
is( $patron->flags, '666666', 'flags field set ok' ); |
294 |
is( $patron->userid, '98233', 'userid field set ok' ); |
295 |
is( $patron->opacnote, 'SmyOpacnote', 'opacnote field set ok' ); |
296 |
is( $patron->contactnote, 'SmyContactnote', 'contactnote field set ok' ); |
297 |
is( $patron->sort1, 'SmySort1', 'sort1 field set ok' ); |
298 |
is( $patron->sort2, 'SmySort2', 'sort2 field set ok' ); |
299 |
is( $patron->altcontactfirstname, 'SmyAltcontactfirstname', 'altcontactfirstname field set ok' ); |
300 |
is( $patron->altcontactsurname, 'SmyAltcontactsurname', 'altcontactsurname field set ok' ); |
301 |
is( $patron->altcontactaddress1, 'SmyAltcontactaddress1', 'altcontactaddress1 field set ok' ); |
302 |
is( $patron->altcontactaddress2, 'SmyAltcontactaddress2', 'altcontactaddress2 field set ok' ); |
303 |
is( $patron->altcontactaddress3, 'SmyAltcontactaddress3', 'altcontactaddress3 field set ok' ); |
304 |
is( $patron->altcontactstate, 'SmyAltcontactstate', 'altcontactstate field set ok' ); |
305 |
is( $patron->altcontactzipcode, '565843', 'altcontactzipcode field set ok' ); |
306 |
is( $patron->altcontactcountry, 'SmyOtherCountry', 'altcontactcountry field set ok' ); |
307 |
is( $patron->altcontactphone, 'SmyOtherphone', 'altcontactphone field set ok' ); |
308 |
is( $patron->smsalertnumber, '0683027347', 'smsalertnumber field set ok' ); |
309 |
is( $patron->privacy, '667789', 'privacy field set ok' ); |
310 |
}; |
316 |
|
311 |
|
317 |
- |
312 |
$schema->storage->txn_rollback; |
|
|
313 |
}; |