|
Lines 19-26
Link Here
|
| 19 |
|
19 |
|
| 20 |
use Modern::Perl; |
20 |
use Modern::Perl; |
| 21 |
|
21 |
|
| 22 |
use Test::More tests => 31; |
22 |
use Test::More tests => 32; |
| 23 |
use Test::Warn; |
23 |
use Test::Warn; |
|
|
24 |
use Test::Exception; |
| 24 |
use Time::Fake; |
25 |
use Time::Fake; |
| 25 |
use DateTime; |
26 |
use DateTime; |
| 26 |
use JSON; |
27 |
use JSON; |
|
Lines 1425-1430
subtest 'Test Koha::Patrons::merge' => sub {
Link Here
|
| 1425 |
$schema->storage->txn_rollback; |
1426 |
$schema->storage->txn_rollback; |
| 1426 |
}; |
1427 |
}; |
| 1427 |
|
1428 |
|
|
|
1429 |
subtest '->store' => sub { |
| 1430 |
plan tests => 1; |
| 1431 |
my $schema = Koha::Database->new->schema; |
| 1432 |
$schema->storage->txn_begin; |
| 1433 |
|
| 1434 |
my $print_error = $schema->storage->dbh->{PrintError}; |
| 1435 |
$schema->storage->dbh->{PrintError} = 0; ; # FIXME This does not longer work - because of the transaction in Koha::Patron->store? |
| 1436 |
|
| 1437 |
my $patron_1 = $builder->build_object({class=> 'Koha::Patrons'}); |
| 1438 |
my $patron_2 = $builder->build_object({class=> 'Koha::Patrons'}); |
| 1439 |
|
| 1440 |
throws_ok |
| 1441 |
{ $patron_2->userid($patron_1->userid)->store; } |
| 1442 |
'Koha::Exceptions::Object::DuplicateID', |
| 1443 |
'AddMember raises an exception on invalid categorycode'; |
| 1444 |
|
| 1445 |
$schema->storage->dbh->{PrintError} = $print_error; |
| 1446 |
$schema->storage->txn_rollback; |
| 1447 |
}; |
| 1448 |
|
| 1449 |
|
| 1428 |
# TODO Move to t::lib::Mocks and reuse it! |
1450 |
# TODO Move to t::lib::Mocks and reuse it! |
| 1429 |
sub set_logged_in_user { |
1451 |
sub set_logged_in_user { |
| 1430 |
my ($patron) = @_; |
1452 |
my ($patron) = @_; |