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

(-)a/t/db_dependent/api/v1/deleted_biblios.t (-2 / +23 lines)
Lines 36-41 use C4::Circulation qw( AddIssue AddReturn ); Link Here
36
36
37
use Koha::Biblios;
37
use Koha::Biblios;
38
use Koha::Database;
38
use Koha::Database;
39
use Koha::DateUtils qw( dt_from_string output_pref );
39
use Koha::Checkouts;
40
use Koha::Checkouts;
40
use Koha::Old::Checkouts;
41
use Koha::Old::Checkouts;
41
42
Lines 164-170 subtest 'get() tests' => sub { Link Here
164
165
165
subtest 'list() tests' => sub {
166
subtest 'list() tests' => sub {
166
167
167
    plan tests => 17;
168
    plan tests => 21;
168
169
169
    $schema->storage->txn_begin;
170
    $schema->storage->txn_begin;
170
171
Lines 228-233 subtest 'list() tests' => sub { Link Here
228
229
229
    $t->get_ok( "//$userid:$password@/api/v1/deleted/biblios?q=$query" => { Accept => 'text/plain' } )->status_is(200);
230
    $t->get_ok( "//$userid:$password@/api/v1/deleted/biblios?q=$query" => { Accept => 'text/plain' } )->status_is(200);
230
231
232
    my $old_biblio_1 = Koha::Old::Biblios->find($biblio_id_1);
233
    my $old_biblio_2 = Koha::Old::Biblios->find($biblio_id_2);
234
235
    $old_biblio_1->set( { timestamp => dt_from_string('2024-12-12T17:33:57+00:00') } )->store();
236
    $old_biblio_2->set( { timestamp => dt_from_string('2024-12-11T17:33:57+00:00') } )->store();
237
238
    $query = encode_json(
239
        {
240
            "-and" => [
241
                { 'me.deleted_on' => { '>=' => '2024-12-12T00:00:00+00:00' } },
242
                [
243
                    { biblio_id => $old_biblio_1->id },
244
                    { biblio_id => $old_biblio_2->id },
245
                ]
246
            ]
247
        }
248
    );
249
250
    $t->get_ok( "//$userid:$password@/api/v1/deleted/biblios?q=$query" => { Accept => 'application/json' } )
251
        ->status_is(200)->json_is( '/0/biblio_id' => $old_biblio_1->id )->json_is( '/1/biblio_id' => undef );
252
231
    # DELETE any biblio with ISBN = TOMAS
253
    # DELETE any biblio with ISBN = TOMAS
232
    Koha::Biblios->search( { 'biblioitem.isbn' => 'TOMAS' }, { join => ['biblioitem'] } )->delete;
254
    Koha::Biblios->search( { 'biblioitem.isbn' => 'TOMAS' }, { join => ['biblioitem'] } )->delete;
233
255
234
- 

Return to bug 38678