|
Lines 19-25
Link Here
|
| 19 |
|
19 |
|
| 20 |
use Modern::Perl; |
20 |
use Modern::Perl; |
| 21 |
|
21 |
|
| 22 |
use Test::More tests => 41; |
22 |
use Test::More tests => 42; |
| 23 |
use Test::Warn; |
23 |
use Test::Warn; |
| 24 |
use Test::Exception; |
24 |
use Test::Exception; |
| 25 |
use Test::MockModule; |
25 |
use Test::MockModule; |
|
Lines 2204-2206
subtest 'extended_attributes' => sub {
Link Here
|
| 2204 |
|
2204 |
|
| 2205 |
$schema->storage->txn_rollback; |
2205 |
$schema->storage->txn_rollback; |
| 2206 |
}; |
2206 |
}; |
| 2207 |
- |
2207 |
|
|
|
2208 |
subtest 'fixup_cardnumber' => sub { |
| 2209 |
|
| 2210 |
plan tests => 3; |
| 2211 |
|
| 2212 |
$schema->storage->txn_begin; |
| 2213 |
|
| 2214 |
Koha::Holds->search->delete; |
| 2215 |
Koha::Checkouts->search->delete; |
| 2216 |
Koha::Patrons->search->delete; |
| 2217 |
|
| 2218 |
my $new_patron = Koha::Patron->new->fixup_cardnumber; |
| 2219 |
is( $new_patron->cardnumber, 1, "NULL+1=1" ); |
| 2220 |
|
| 2221 |
$builder->build_object({ class => 'Koha::Patrons', value => {cardnumber => "a string"} }); |
| 2222 |
$builder->build_object({ class => 'Koha::Patrons', value => {cardnumber => 10} }); |
| 2223 |
$builder->build_object({ class => 'Koha::Patrons', value => {cardnumber => 100} }); |
| 2224 |
$builder->build_object({ class => 'Koha::Patrons', value => {cardnumber => 20} }); |
| 2225 |
$builder->build_object({ class => 'Koha::Patrons', value => {cardnumber => "a big 9999 string"} }); |
| 2226 |
$builder->build_object({ class => 'Koha::Patrons', value => {cardnumber => "P13000"} }); |
| 2227 |
|
| 2228 |
$new_patron = Koha::Patron->new->fixup_cardnumber; |
| 2229 |
is( $new_patron->cardnumber, 101, "100+1=101" ); |
| 2230 |
|
| 2231 |
$builder->build_object({ class => 'Koha::Patrons', value => {cardnumber => 603628999632182575912} }); |
| 2232 |
|
| 2233 |
$new_patron = Koha::Patron->new->fixup_cardnumber; |
| 2234 |
is( $new_patron->cardnumber, 603628999632182575914, "603628999632182575912+1=603628999632182575913" ); |
| 2235 |
|
| 2236 |
$schema->storage->txn_rollback; |
| 2237 |
}; |