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