Bugzilla – Attachment 123069 Details for
Bug 28744
Class with empty/no to_api_mapping should generate an empty from_api_mapping
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 28744: Regression tests
Bug-28744-Regression-tests.patch (text/plain), 1.86 KB, created by
Tomás Cohen Arazi (tcohen)
on 2021-07-23 03:41:47 UTC
(
hide
)
Description:
Bug 28744: Regression tests
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2021-07-23 03:41:47 UTC
Size:
1.86 KB
patch
obsolete
>From 156549e32f8c7e8a6ac0811e451493e7faa45afd Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Fri, 23 Jul 2021 00:35:49 -0300 >Subject: [PATCH] Bug 28744: Regression tests > >This patch adds tests for the following cases: >- to_api_mapping not defined >- to_api_mapping returning an empty hashref > >To test: >1. Apply this patch >2. Run: > $ kshell > k$ prove t/db_dependent/Koha/Object.t >=> FAIL: Tests fail :-( > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > t/db_dependent/Koha/Object.t | 26 +++++++++++++++++++++++++- > 1 file changed, 25 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/Koha/Object.t b/t/db_dependent/Koha/Object.t >index 55485d3580..29d6876268 100755 >--- a/t/db_dependent/Koha/Object.t >+++ b/t/db_dependent/Koha/Object.t >@@ -390,7 +390,7 @@ subtest "to_api_mapping() tests" => sub { > > subtest "from_api_mapping() tests" => sub { > >- plan tests => 3; >+ plan tests => 5; > > $schema->storage->txn_begin; > >@@ -449,6 +449,30 @@ subtest "from_api_mapping() tests" => sub { > 'Fresh mapping loaded' > ); > >+ $city_class->unmock( 'to_api_mapping'); >+ # $city_class->mock( 'to_api_mapping', sub { return {}; }); >+ $city_class->mock( 'to_api_mapping', undef ); >+ >+ # Get a fresh object >+ $city = $builder->build_object({ class => 'Koha::Cities' }); >+ is_deeply( >+ $city->from_api_mapping, >+ {}, >+ 'No to_api_mapping then empty hashref' >+ ); >+ >+ $city_class->unmock( 'to_api_mapping'); >+ # $city_class->mock( 'to_api_mapping', sub { return {}; }); >+ $city_class->mock( 'to_api_mapping', sub { return; } ); >+ >+ # Get a fresh object >+ $city = $builder->build_object({ class => 'Koha::Cities' }); >+ is_deeply( >+ $city->from_api_mapping, >+ {}, >+ 'Empty to_api_mapping then empty hashref' >+ ); >+ > $schema->storage->txn_rollback; > }; > >-- >2.32.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 28744
:
123069
|
123070
|
123152
|
123153
|
124162
|
124163
|
124189
|
124190
|
124238
|
124239