Lines 23-28
use Test::Mojo;
Link Here
|
23 |
use t::lib::TestBuilder; |
23 |
use t::lib::TestBuilder; |
24 |
use t::lib::Mocks; |
24 |
use t::lib::Mocks; |
25 |
|
25 |
|
|
|
26 |
use C4::Biblio qw( GetMarcFromKohaField ); |
27 |
|
26 |
use Koha::ERM::EHoldings::Titles; |
28 |
use Koha::ERM::EHoldings::Titles; |
27 |
use Koha::ERM::EHoldings::Packages; |
29 |
use Koha::ERM::EHoldings::Packages; |
28 |
use Koha::Virtualshelves; |
30 |
use Koha::Virtualshelves; |
Lines 337-343
subtest 'add() tests' => sub {
Link Here
|
337 |
|
339 |
|
338 |
subtest 'update() tests' => sub { |
340 |
subtest 'update() tests' => sub { |
339 |
|
341 |
|
340 |
plan tests => 15; |
342 |
plan tests => 16; |
341 |
|
343 |
|
342 |
$schema->storage->txn_begin; |
344 |
$schema->storage->txn_begin; |
343 |
|
345 |
|
Lines 460-465
subtest 'update() tests' => sub {
Link Here
|
460 |
"//$userid:$password@/api/v1/erm/eholdings/local/titles/$ehtitle_id" => |
462 |
"//$userid:$password@/api/v1/erm/eholdings/local/titles/$ehtitle_id" => |
461 |
json => $ehtitle_with_updated_field )->status_is(404); |
463 |
json => $ehtitle_with_updated_field )->status_is(404); |
462 |
|
464 |
|
|
|
465 |
subtest 'update eholdings title linked to biblio tests' => sub { |
466 |
|
467 |
plan tests => 4; |
468 |
|
469 |
my $biblio = $builder->build_sample_biblio(); |
470 |
my $record = $biblio->metadata->record(); |
471 |
warn $record->as_formatted; |
472 |
|
473 |
my $ehtitle_id = |
474 |
$builder->build_object( { class => 'Koha::ERM::EHoldings::Titles', value => { biblio_id => $biblio->id } } ) |
475 |
->title_id; |
476 |
my $ehtitle_updated_title = { publication_title => "The journal of writing unit tests :" }; |
477 |
|
478 |
$t->put_ok( |
479 |
"//$userid:$password@/api/v1/erm/eholdings/local/titles/$ehtitle_id" => |
480 |
json => $ehtitle_updated_title )->status_is(200) |
481 |
->json_is( '/publication_title' => 'The journal of writing unit tests :' ); |
482 |
|
483 |
$biblio->discard_changes; |
484 |
warn $biblio->title; |
485 |
my $record_after = $biblio->metadata->record; |
486 |
|
487 |
my ( $title_tag, $title_subfield ) = GetMarcFromKohaField( 'biblio.title' ); |
488 |
is( $record_after->subfield( $title_tag, $title_subfield), "The journal of writing unit tests :", "Biblio title is correctly update by eholding title update"); |
489 |
|
490 |
is( $record->delete_field($title_tag)->as_formatted, $record_after->delete_field($title_tag)->as_formatted, "The record is other untouched" ); |
491 |
|
492 |
}; |
493 |
|
463 |
$schema->storage->txn_rollback; |
494 |
$schema->storage->txn_rollback; |
464 |
}; |
495 |
}; |
465 |
|
496 |
|
466 |
- |
|
|