Lines 192-198
subtest 'get() tests' => sub {
Link Here
|
192 |
|
192 |
|
193 |
subtest 'add() tests' => sub { |
193 |
subtest 'add() tests' => sub { |
194 |
|
194 |
|
195 |
plan tests => 24; |
195 |
plan tests => 25; |
196 |
|
196 |
|
197 |
$schema->storage->txn_begin; |
197 |
$schema->storage->txn_begin; |
198 |
|
198 |
|
Lines 334-339
subtest 'add() tests' => sub {
Link Here
|
334 |
] |
334 |
] |
335 |
); |
335 |
); |
336 |
|
336 |
|
|
|
337 |
subtest 'add eholdings title linked to biblio tests' => sub { |
338 |
|
339 |
plan tests => 4; |
340 |
|
341 |
delete $ehtitle->{title_id}; |
342 |
my $request_body = { |
343 |
%{$ehtitle}, |
344 |
}; |
345 |
$request_body->{create_linked_biblio} = 1; |
346 |
my $biblios_count = Koha::Biblios->search()->count; |
347 |
$t->post_ok( "//$userid:$password@/api/v1/erm/eholdings/local/titles/" => json => $request_body ) |
348 |
->status_is(201)->json_is( '/publication_title' => 'Publication title' ); |
349 |
my $new_biblios_count = Koha::Biblios->search()->count; |
350 |
is( $new_biblios_count, $biblios_count + 1, "Biblio was added" ); |
351 |
}; |
352 |
|
337 |
$schema->storage->txn_rollback; |
353 |
$schema->storage->txn_rollback; |
338 |
}; |
354 |
}; |
339 |
|
355 |
|
Lines 475-481
subtest 'update() tests' => sub {
Link Here
|
475 |
my $ehtitle_updated_title = { publication_title => "The journal of writing unit tests :" }; |
491 |
my $ehtitle_updated_title = { publication_title => "The journal of writing unit tests :" }; |
476 |
|
492 |
|
477 |
$t->put_ok( |
493 |
$t->put_ok( |
478 |
"//$userid:$password@/api/v1/erm/eholdings/local/titles/$ehtitle_id" => json => $ehtitle_updated_title ) |
494 |
"//$userid:$password@/api/v1/erm/eholdings/local/titles/$ehtitle_id" => json => { %$ehtitle_updated_title, create_linked_biblio => 1 } ) |
479 |
->status_is(200)->json_is( '/publication_title' => 'The journal of writing unit tests :' ); |
495 |
->status_is(200)->json_is( '/publication_title' => 'The journal of writing unit tests :' ); |
480 |
|
496 |
|
481 |
$biblio->discard_changes; |
497 |
$biblio->discard_changes; |
482 |
- |
|
|