|
Lines 19-27
Link Here
|
| 19 |
|
19 |
|
| 20 |
use Modern::Perl; |
20 |
use Modern::Perl; |
| 21 |
|
21 |
|
| 22 |
use Test::More tests => 6; |
22 |
use Test::More tests => 7; |
| 23 |
use Test::Warn; |
23 |
use Test::Warn; |
| 24 |
|
24 |
|
|
|
25 |
use C4::Members; |
| 25 |
use Koha::Patron; |
26 |
use Koha::Patron; |
| 26 |
use Koha::Patrons; |
27 |
use Koha::Patrons; |
| 27 |
use Koha::Database; |
28 |
use Koha::Database; |
|
Lines 127-132
subtest 'update_password' => sub {
Link Here
|
| 127 |
is( $number_of_logs, 1, 'With BorrowerLogs, Koha::Patron->update_password should not have logged' ); |
128 |
is( $number_of_logs, 1, 'With BorrowerLogs, Koha::Patron->update_password should not have logged' ); |
| 128 |
}; |
129 |
}; |
| 129 |
|
130 |
|
|
|
131 |
subtest "move_to_deleted" => sub { |
| 132 |
plan tests => 2; |
| 133 |
my $patron = $builder->build( { source => 'Borrower' } ); |
| 134 |
my $retrieved_patron = Koha::Patrons->find( $patron->{borrowernumber} ); |
| 135 |
is( ref( $retrieved_patron->move_to_deleted ), 'Koha::Schema::Result::Deletedborrower', 'Koha::Patron->move_to_deleted should return the Deleted patron' ) |
| 136 |
; # FIXME This should be Koha::Deleted::Patron |
| 137 |
my $deleted_patron = $schema->resultset('Deletedborrower') |
| 138 |
->search( { borrowernumber => $patron->{borrowernumber} }, { result_class => 'DBIx::Class::ResultClass::HashRefInflator' } ) |
| 139 |
->next; |
| 140 |
is_deeply( $deleted_patron, $patron, 'Koha::Patron->move_to_deleted should have correctly moved the patron to the deleted table' ); |
| 141 |
C4::Members::DelMember( $patron->{borrowernumber} ); # Cleanup |
| 142 |
}; |
| 143 |
|
| 130 |
$retrieved_patron_1->delete; |
144 |
$retrieved_patron_1->delete; |
| 131 |
is( Koha::Patrons->search->count, $nb_of_patrons + 1, 'Delete should have deleted the patron' ); |
145 |
is( Koha::Patrons->search->count, $nb_of_patrons + 1, 'Delete should have deleted the patron' ); |
| 132 |
|
146 |
|