Lines 17-23
Link Here
|
17 |
|
17 |
|
18 |
use Modern::Perl; |
18 |
use Modern::Perl; |
19 |
|
19 |
|
20 |
use Test::More tests => 4; |
20 |
use Test::More tests => 5; |
21 |
use Test::Exception; |
21 |
use Test::Exception; |
22 |
use Test::Warn; |
22 |
use Test::Warn; |
23 |
|
23 |
|
Lines 266-268
subtest '_embed_items' => sub {
Link Here
|
266 |
|
266 |
|
267 |
$schema->storage->txn_rollback; |
267 |
$schema->storage->txn_rollback; |
268 |
}; |
268 |
}; |
269 |
- |
269 |
|
|
|
270 |
subtest 'can_be_edited() tests' => sub { |
271 |
|
272 |
plan tests => 4; |
273 |
|
274 |
$schema->storage->txn_begin; |
275 |
|
276 |
my $biblio = $builder->build_sample_biblio; |
277 |
|
278 |
my $metadata = $biblio->metadata; |
279 |
is( $metadata->record_source_id, undef, 'No record source defined for metatada object' ); |
280 |
ok( $metadata->can_be_edited, 'No record source, can be edited' ); |
281 |
|
282 |
my $source = $builder->build_object( { class => 'Koha::RecordSources', value => { can_be_edited => 1 } } ); |
283 |
$metadata->record_source_id( $source->id )->store(); |
284 |
|
285 |
ok( $metadata->can_be_edited, 'Record source allows, can be edited' ); |
286 |
|
287 |
$source->can_be_edited(0)->store(); |
288 |
$metadata->discard_changes; |
289 |
|
290 |
ok( !$metadata->can_be_edited, 'Record source does not allow, cannot be edited' ); |
291 |
|
292 |
$schema->storage->txn_rollback; |
293 |
}; |