|
Lines 19-26
Link Here
|
| 19 |
|
19 |
|
| 20 |
use Modern::Perl; |
20 |
use Modern::Perl; |
| 21 |
|
21 |
|
| 22 |
use Test::More tests => 21; |
22 |
use Test::More tests => 22; |
| 23 |
use Test::Exception; |
23 |
use Test::Exception; |
|
|
24 |
use Test::MockModule; |
| 24 |
use Test::Warn; |
25 |
use Test::Warn; |
| 25 |
|
26 |
|
| 26 |
use Koha::Authority::Types; |
27 |
use Koha::Authority::Types; |
|
Lines 799-801
subtest 'prefetch_whitelist() tests' => sub {
Link Here
|
| 799 |
|
800 |
|
| 800 |
$schema->storage->txn_rollback; |
801 |
$schema->storage->txn_rollback; |
| 801 |
}; |
802 |
}; |
| 802 |
- |
803 |
|
|
|
804 |
subtest 'delete() tests' => sub { |
| 805 |
|
| 806 |
plan tests => 2; |
| 807 |
|
| 808 |
$schema->storage->txn_begin; |
| 809 |
|
| 810 |
# Make sure no cities |
| 811 |
warnings_are { Koha::Cities->delete }[], |
| 812 |
"No warnings, no Koha::City->delete called as it doesn't exist"; |
| 813 |
|
| 814 |
# Mock Koha::City |
| 815 |
my $mocked_city = Test::MockModule->new('Koha::City'); |
| 816 |
$mocked_city->mock( |
| 817 |
'delete', |
| 818 |
sub { |
| 819 |
warn "delete called!"; |
| 820 |
} |
| 821 |
); |
| 822 |
|
| 823 |
# Add two cities |
| 824 |
$builder->build_object( { class => 'Koha::Cities' } ); |
| 825 |
$builder->build_object( { class => 'Koha::Cities' } ); |
| 826 |
|
| 827 |
warnings_are { Koha::Cities->delete } |
| 828 |
[ "delete called!", "delete called!" ], |
| 829 |
"No warnings, no Koha::City->delete called as it doesn't exist"; |
| 830 |
|
| 831 |
$schema->storage->txn_rollback; |
| 832 |
}; |