|
Lines 17-27
Link Here
|
| 17 |
|
17 |
|
| 18 |
use Modern::Perl; |
18 |
use Modern::Perl; |
| 19 |
|
19 |
|
| 20 |
use Test::More tests => 6; |
20 |
use Test::More tests => 7; |
| 21 |
use Test::Warn; |
21 |
use Test::Warn; |
| 22 |
|
22 |
|
| 23 |
use C4::Context; |
23 |
use C4::Context; |
| 24 |
use Koha::Database; |
24 |
use Koha::Database; |
|
|
25 |
use Koha::DateUtils qw( dt_from_string ); |
| 26 |
|
| 27 |
use t::lib::TestBuilder; |
| 25 |
|
28 |
|
| 26 |
BEGIN { |
29 |
BEGIN { |
| 27 |
use_ok('Koha::Object'); |
30 |
use_ok('Koha::Object'); |
|
Lines 89-92
subtest 'get_column' => sub {
Link Here
|
| 89 |
my $patron = Koha::Patron->new({categorycode => $categorycode, branchcode => $branchcode })->store; |
92 |
my $patron = Koha::Patron->new({categorycode => $categorycode, branchcode => $branchcode })->store; |
| 90 |
is( $patron->get_column('borrowernumber'), $patron->borrowernumber, 'get_column should retrieve the correct value' ); |
93 |
is( $patron->get_column('borrowernumber'), $patron->borrowernumber, 'get_column should retrieve the correct value' ); |
| 91 |
}; |
94 |
}; |
|
|
95 |
|
| 96 |
subtest 'discard_changes' => sub { |
| 97 |
plan tests => 1; |
| 98 |
my $builder = t::lib::TestBuilder->new; |
| 99 |
my $patron = $builder->build( { source => 'Borrower' } ); |
| 100 |
$patron = Koha::Patrons->find( $patron->{borrowernumber} ); |
| 101 |
$patron->dateexpiry(dt_from_string); |
| 102 |
$patron->discard_changes; |
| 103 |
is( |
| 104 |
dt_from_string( $patron->dateexpiry ), |
| 105 |
dt_from_string->truncate( to => 'day' ), |
| 106 |
'discard_changes should refresh the object' |
| 107 |
); |
| 108 |
}; |
| 109 |
|
| 92 |
1; |
110 |
1; |
| 93 |
- |
|
|