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

(-)a/t/db_dependent/Koha/Objects.t (-4 / +23 lines)
Lines 29-34 use C4::Context; Link Here
29
use Koha::Authority::Types;
29
use Koha::Authority::Types;
30
use Koha::Cities;
30
use Koha::Cities;
31
use Koha::Biblios;
31
use Koha::Biblios;
32
use Koha::Items;
32
use Koha::Patron::Category;
33
use Koha::Patron::Category;
33
use Koha::Patron::Categories;
34
use Koha::Patron::Categories;
34
use Koha::Patrons;
35
use Koha::Patrons;
Lines 1286-1298 subtest 'empty() tests' => sub { Link Here
1286
1287
1287
subtest 'delete() tests' => sub {
1288
subtest 'delete() tests' => sub {
1288
1289
1289
    plan tests => 2;
1290
    plan tests => 3;
1290
1291
1291
    $schema->storage->txn_begin;
1292
    $schema->storage->txn_begin;
1292
1293
1293
    # Make sure no cities
1294
    # Make sure no cities
1294
    warnings_are { Koha::Cities->delete }[],
1295
    warnings_are { Koha::Cities->delete }[],
1295
      "No warnings, no Koha::City->delete called as it doesn't exist";
1296
        "No warnings, no Koha::City->delete called as it doesn't exist";
1296
1297
1297
    # Mock Koha::City
1298
    # Mock Koha::City
1298
    my $mocked_city = Test::MockModule->new('Koha::City');
1299
    my $mocked_city = Test::MockModule->new('Koha::City');
Lines 1311-1317 subtest 'delete() tests' => sub { Link Here
1311
    my $cities = Koha::Cities->search;
1312
    my $cities = Koha::Cities->search;
1312
    $cities->next;
1313
    $cities->next;
1313
    warnings_are { $cities->delete }
1314
    warnings_are { $cities->delete }
1314
        [ "delete called!", "delete called!" ],
1315
    [ "delete called!", "delete called!" ],
1316
        "No warnings, no Koha::City->delete called as it doesn't exist";
1317
1318
    my $item_id_1 = $builder->build_sample_item()->id;
1319
    my $item_id_2 = $builder->build_sample_item()->id;
1320
1321
    # Mock Koha::City
1322
    my $mocked_item = Test::MockModule->new('Koha::Item');
1323
    $mocked_item->mock(
1324
        'delete',
1325
        sub {
1326
            my ( $self, $params ) = @_;
1327
            warn ref($self);
1328
            warn $params->{skip_record_index};
1329
        }
1330
    );
1331
    my $items = Koha::Items->search( { itemnumber => [ $item_id_1, $item_id_2 ] } );
1332
1333
    warning_is { $items->delete( { skip_record_index => 1 } ) }
1334
    [ "Koha::Item", "1", "Koha::Item", "1" ],
1315
        "No warnings, no Koha::City->delete called as it doesn't exist";
1335
        "No warnings, no Koha::City->delete called as it doesn't exist";
1316
1336
1317
    $schema->storage->txn_rollback;
1337
    $schema->storage->txn_rollback;
1318
- 

Return to bug 36873