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

(-)a/Koha/Object.pm (-1 / +1 lines)
Lines 246-252 sub AUTOLOAD { Link Here
246
        }
246
        }
247
    }
247
    }
248
248
249
    my @known_methods = qw( is_changed id in_storage get_column );
249
    my @known_methods = qw( is_changed id in_storage get_column discard_changes);
250
250
251
    Koha::Exceptions::Object::MethodNotCoveredByTests->throw( "The method $method is not covered by tests!" ) unless grep {/^$method$/} @known_methods;
251
    Koha::Exceptions::Object::MethodNotCoveredByTests->throw( "The method $method is not covered by tests!" ) unless grep {/^$method$/} @known_methods;
252
252
(-)a/t/db_dependent/Koha/Object.t (-2 / +19 lines)
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
- 

Return to bug 17594