Lines 27-32
use t::lib::Mocks;
Link Here
|
27 |
|
27 |
|
28 |
use C4::Auth; |
28 |
use C4::Auth; |
29 |
use Koha::Database; |
29 |
use Koha::Database; |
|
|
30 |
use Koha::DateUtils qw(dt_from_string output_pref); |
30 |
use Koha::Exceptions::Patron; |
31 |
use Koha::Exceptions::Patron; |
31 |
use Koha::Exceptions::Patron::Attribute; |
32 |
use Koha::Exceptions::Patron::Attribute; |
32 |
use Koha::Patron::Attributes; |
33 |
use Koha::Patron::Attributes; |
Lines 46-52
subtest 'list() tests' => sub {
Link Here
|
46 |
$schema->storage->txn_rollback; |
47 |
$schema->storage->txn_rollback; |
47 |
|
48 |
|
48 |
subtest 'librarian access tests' => sub { |
49 |
subtest 'librarian access tests' => sub { |
49 |
plan tests => 16; |
50 |
plan tests => 17; |
50 |
|
51 |
|
51 |
$schema->storage->txn_begin; |
52 |
$schema->storage->txn_begin; |
52 |
|
53 |
|
Lines 84-89
subtest 'list() tests' => sub {
Link Here
|
84 |
->json_is( '/0/restricted' => Mojo::JSON->true ) |
85 |
->json_is( '/0/restricted' => Mojo::JSON->true ) |
85 |
->json_hasnt('/1'); |
86 |
->json_hasnt('/1'); |
86 |
|
87 |
|
|
|
88 |
subtest 'searching date and date-time fields' => sub { |
89 |
|
90 |
plan tests => 6; |
91 |
|
92 |
my $date_of_birth = '1980-06-18'; |
93 |
my $last_seen = '2021-06-25 14:05:35'; |
94 |
|
95 |
my $patron = $builder->build_object( |
96 |
{ |
97 |
class => 'Koha::Patrons', |
98 |
value => { |
99 |
dateofbirth => $date_of_birth, |
100 |
lastseen => $last_seen, |
101 |
} |
102 |
} |
103 |
); |
104 |
|
105 |
my $last_seen_rfc3339 = $last_seen . "z"; |
106 |
|
107 |
$t->get_ok("//$userid:$password@/api/v1/patrons?date_of_birth=" . $date_of_birth . "&cardnumber=" . $patron->cardnumber) |
108 |
->status_is(200) |
109 |
->json_is( '/0/patron_id' => $patron->id, 'Filtering by date works' ); |
110 |
|
111 |
$t->get_ok("//$userid:$password@/api/v1/patrons?last_seen=" . $last_seen_rfc3339 . "&cardnumber=" . $patron->cardnumber) |
112 |
->status_is(200) |
113 |
->json_is( '/0/patron_id' => $patron->id, 'Filtering by date-time works' ); |
114 |
}; |
115 |
|
87 |
$schema->storage->txn_rollback; |
116 |
$schema->storage->txn_rollback; |
88 |
}; |
117 |
}; |
89 |
}; |
118 |
}; |
90 |
- |
|
|