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

(-)a/t/db_dependent/Koha/Object.t (-1 / +1 lines)
Lines 255-261 subtest 'store() tests' => sub { Link Here
255
    my $api_key = Koha::ApiKey->new({ patron_id => $patron_id });
255
    my $api_key = Koha::ApiKey->new({ patron_id => $patron_id });
256
256
257
    my $print_error = $schema->storage->dbh->{PrintError};
257
    my $print_error = $schema->storage->dbh->{PrintError};
258
    $schema->storage->dbh->{PrintError} = 0; # FIXME This does not longer work - because of the transaction in Koha::Patron->store?
258
    $schema->storage->dbh->{PrintError} = 0;
259
    throws_ok
259
    throws_ok
260
        { $api_key->store }
260
        { $api_key->store }
261
        'Koha::Exceptions::Object::FKConstraint',
261
        'Koha::Exceptions::Object::FKConstraint',
(-)a/t/db_dependent/Koha/Patrons.t (-1 / +23 lines)
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) = @_;
(-)a/t/db_dependent/Members.t (-1 / +3 lines)
Lines 176-181 is( $borrower->{dateenrolled}, '2015-09-06', 'Koha::Patron->store should correct Link Here
176
subtest 'Koha::Patron->store should not update userid if not true' => sub {
176
subtest 'Koha::Patron->store should not update userid if not true' => sub {
177
    plan tests => 3;
177
    plan tests => 3;
178
178
179
    # TODO Move this to t/db_dependent/Koha/Patrons.t subtest ->store
180
179
    $data{ cardnumber } = "234567890";
181
    $data{ cardnumber } = "234567890";
180
    $data{userid} = 'a_user_id';
182
    $data{userid} = 'a_user_id';
181
    $borrowernumber = Koha::Patron->new( \%data )->store->borrowernumber;
183
    $borrowernumber = Koha::Patron->new( \%data )->store->borrowernumber;
Lines 382-387 $schema->storage->txn_rollback; Link Here
382
384
383
subtest 'Koha::Patron->store (invalid categorycode) tests' => sub {
385
subtest 'Koha::Patron->store (invalid categorycode) tests' => sub {
384
    plan tests => 1;
386
    plan tests => 1;
387
    # TODO Move this to t/db_dependent/Koha/Patrons.t subtest ->store
385
388
386
    $schema->storage->txn_begin;
389
    $schema->storage->txn_begin;
387
390
388
- 

Return to bug 20287