Lines 17-25
Link Here
|
17 |
|
17 |
|
18 |
use Modern::Perl; |
18 |
use Modern::Perl; |
19 |
|
19 |
|
20 |
use Test::More tests => 64; |
20 |
use Test::More tests => 65; |
21 |
use Test::MockModule; |
21 |
use Test::MockModule; |
22 |
use Data::Dumper; |
22 |
use Data::Dumper qw/Dumper/; |
23 |
use C4::Context; |
23 |
use C4::Context; |
24 |
use Koha::Database; |
24 |
use Koha::Database; |
25 |
use Koha::Holds; |
25 |
use Koha::Holds; |
Lines 37-43
my $schema = Koha::Database->schema;
Link Here
|
37 |
$schema->storage->txn_begin; |
37 |
$schema->storage->txn_begin; |
38 |
my $builder = t::lib::TestBuilder->new; |
38 |
my $builder = t::lib::TestBuilder->new; |
39 |
my $dbh = C4::Context->dbh; |
39 |
my $dbh = C4::Context->dbh; |
40 |
$dbh->{RaiseError} = 1; |
|
|
41 |
|
40 |
|
42 |
# Remove invalid guarantorid's as long as we have no FK |
41 |
# Remove invalid guarantorid's as long as we have no FK |
43 |
$dbh->do("UPDATE borrowers b1 LEFT JOIN borrowers b2 ON b2.borrowernumber=b1.guarantorid SET b1.guarantorid=NULL where b1.guarantorid IS NOT NULL AND b2.borrowernumber IS NULL"); |
42 |
$dbh->do("UPDATE borrowers b1 LEFT JOIN borrowers b2 ON b2.borrowernumber=b1.guarantorid SET b1.guarantorid=NULL where b1.guarantorid IS NOT NULL AND b2.borrowernumber IS NULL"); |
Lines 491-494
eval {
Link Here
|
491 |
is($@, '', 'Bug 16009: GetMember(cardnumber => undef) works'); |
490 |
is($@, '', 'Bug 16009: GetMember(cardnumber => undef) works'); |
492 |
is($patron, undef, 'Bug 16009: GetMember(cardnumber => undef) returns undef'); |
491 |
is($patron, undef, 'Bug 16009: GetMember(cardnumber => undef) returns undef'); |
493 |
|
492 |
|
494 |
1; |
493 |
subtest 'Trivial test for AddMember_Auto' => sub { |
|
|
494 |
plan tests => 3; |
495 |
my $members_mock = Test::MockModule->new( 'C4::Members' ); |
496 |
$members_mock->mock( 'fixup_cardnumber', sub { 12345; } ); |
497 |
my $library = $builder->build({ source => 'Branch' }); |
498 |
my $category = $builder->build({ source => 'Category' }); |
499 |
my %borr = AddMember_Auto( surname=> 'Dick3', firstname => 'Philip', branchcode => $library->{branchcode}, categorycode => $category->{categorycode}, password => '34567890' ); |
500 |
ok( $borr{borrowernumber}, 'Borrower hash contains borrowernumber' ); |
501 |
is( $borr{cardnumber}, 12345, 'Borrower hash contains cardnumber' ); |
502 |
$patron = Koha::Patrons->find( $borr{borrowernumber} ); |
503 |
isnt( $patron, undef, 'Patron found' ); |
504 |
}; |
505 |
|
506 |
$schema->storage->txn_rollback; |
495 |
- |
|
|