Lines 390-396
subtest "to_api_mapping() tests" => sub {
Link Here
|
390 |
|
390 |
|
391 |
subtest "from_api_mapping() tests" => sub { |
391 |
subtest "from_api_mapping() tests" => sub { |
392 |
|
392 |
|
393 |
plan tests => 3; |
393 |
plan tests => 5; |
394 |
|
394 |
|
395 |
$schema->storage->txn_begin; |
395 |
$schema->storage->txn_begin; |
396 |
|
396 |
|
Lines 449-454
subtest "from_api_mapping() tests" => sub {
Link Here
|
449 |
'Fresh mapping loaded' |
449 |
'Fresh mapping loaded' |
450 |
); |
450 |
); |
451 |
|
451 |
|
|
|
452 |
$city_class->unmock( 'to_api_mapping'); |
453 |
# $city_class->mock( 'to_api_mapping', sub { return {}; }); |
454 |
$city_class->mock( 'to_api_mapping', undef ); |
455 |
|
456 |
# Get a fresh object |
457 |
$city = $builder->build_object({ class => 'Koha::Cities' }); |
458 |
is_deeply( |
459 |
$city->from_api_mapping, |
460 |
{}, |
461 |
'No to_api_mapping then empty hashref' |
462 |
); |
463 |
|
464 |
$city_class->unmock( 'to_api_mapping'); |
465 |
# $city_class->mock( 'to_api_mapping', sub { return {}; }); |
466 |
$city_class->mock( 'to_api_mapping', sub { return; } ); |
467 |
|
468 |
# Get a fresh object |
469 |
$city = $builder->build_object({ class => 'Koha::Cities' }); |
470 |
is_deeply( |
471 |
$city->from_api_mapping, |
472 |
{}, |
473 |
'Empty to_api_mapping then empty hashref' |
474 |
); |
475 |
|
452 |
$schema->storage->txn_rollback; |
476 |
$schema->storage->txn_rollback; |
453 |
}; |
477 |
}; |
454 |
|
478 |
|
455 |
- |
|
|