Lines 267-275
subtest '_embed_items' => sub {
Link Here
|
267 |
$schema->storage->txn_rollback; |
267 |
$schema->storage->txn_rollback; |
268 |
}; |
268 |
}; |
269 |
|
269 |
|
270 |
subtest 'source_allows_editing() tests' => sub { |
270 |
subtest 'record_source() and source_allows_editing() tests' => sub { |
271 |
|
271 |
|
272 |
plan tests => 4; |
272 |
plan tests => 7; |
273 |
|
273 |
|
274 |
$schema->storage->txn_begin; |
274 |
$schema->storage->txn_begin; |
275 |
|
275 |
|
Lines 278-288
subtest 'source_allows_editing() tests' => sub {
Link Here
|
278 |
my $metadata = $biblio->metadata; |
278 |
my $metadata = $biblio->metadata; |
279 |
is( $metadata->record_source_id, undef, 'No record source defined for metatada object' ); |
279 |
is( $metadata->record_source_id, undef, 'No record source defined for metatada object' ); |
280 |
ok( $metadata->source_allows_editing, 'No record source, can be edited' ); |
280 |
ok( $metadata->source_allows_editing, 'No record source, can be edited' ); |
|
|
281 |
is( $metadata->record_source, undef ); |
281 |
|
282 |
|
282 |
my $source = $builder->build_object( { class => 'Koha::RecordSources', value => { can_be_edited => 1 } } ); |
283 |
my $source = $builder->build_object( { class => 'Koha::RecordSources', value => { can_be_edited => 1 } } ); |
283 |
$metadata->record_source_id( $source->id )->store(); |
284 |
$metadata->record_source_id( $source->id )->store(); |
284 |
|
285 |
|
|
|
286 |
my $retrieved_source = $metadata->record_source; |
287 |
|
285 |
ok( $metadata->source_allows_editing, 'Record source allows, can be edited' ); |
288 |
ok( $metadata->source_allows_editing, 'Record source allows, can be edited' ); |
|
|
289 |
is( ref($retrieved_source), 'Koha::RecordSource' ); |
290 |
is( $retrieved_source->id, $source->id ); |
286 |
|
291 |
|
287 |
$source->can_be_edited(0)->store(); |
292 |
$source->can_be_edited(0)->store(); |
288 |
$metadata->discard_changes; |
293 |
$metadata->discard_changes; |
289 |
- |
|
|