Bugzilla – Attachment 69441 Details for
Bug 18595
Move C4::Members::Messaging to Koha namespace
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 18595: Unit tests for Koha::Patron::Categories->default_messaging
Bug-18595-Unit-tests-for-KohaPatronCategories-defa.patch (text/plain), 3.16 KB, created by
Lari Taskula
on 2017-12-01 16:19:09 UTC
(
hide
)
Description:
Bug 18595: Unit tests for Koha::Patron::Categories->default_messaging
Filename:
MIME Type:
Creator:
Lari Taskula
Created:
2017-12-01 16:19:09 UTC
Size:
3.16 KB
patch
obsolete
>From b435ee4cf76dd9ec334113885b4358e4c4936f60 Mon Sep 17 00:00:00 2001 >From: Lari Taskula <lari.taskula@jns.fi> >Date: Wed, 2 Nov 2016 16:49:24 +0200 >Subject: [PATCH] Bug 18595: Unit tests for > Koha::Patron::Categories->default_messaging >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >This patch adds unit tests for Koha::Patron::Categories->default_messaging. Tests >will help preparing for moving C4::Members::Messaging to Koha-objects. > >To test: >1. Run t/db_dependent/Koha/Patron/Categories.t > >Signed-off-by: Marc Véron <veron@veron.ch> >--- > t/db_dependent/Koha/Patron/Categories.t | 41 ++++++++++++++++++++++++++++++++- > 1 file changed, 40 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/Koha/Patron/Categories.t b/t/db_dependent/Koha/Patron/Categories.t >index 6a0171f..f1ac0c1 100644 >--- a/t/db_dependent/Koha/Patron/Categories.t >+++ b/t/db_dependent/Koha/Patron/Categories.t >@@ -19,11 +19,13 @@ > > use Modern::Perl; > >-use Test::More tests => 10; >+use Test::More tests => 11; > > use C4::Context; >+use C4::Members::Messaging; > use Koha::Database; > use Koha::DateUtils; >+use Koha::Patron; > use Koha::Patron::Category; > use Koha::Patron::Categories; > use t::lib::TestBuilder; >@@ -100,6 +102,43 @@ subtest 'BlockExpiredPatronOpacActions' => sub { > $category->delete; > }; > >+subtest 'default_messaging tests' => sub { >+ plan tests => 5; >+ >+ my $next_month = dt_from_string->add( months => 1 ); >+ my $category = Koha::Patron::Category->new({ >+ categorycode => 'my2ndcat', >+ category_type => 'A', >+ description => 'mycatdesc', >+ enrolmentperiod => undef, >+ enrolmentperioddate => $next_month, >+ })->store; >+ my $attr = $builder->build({ source => 'MessageAttribute', }); >+ my $transport = $builder->build({ >+ source => 'MessageTransport', >+ value => { >+ message_attribute_id => $attr->{'message_attribute_id'}, >+ message_transport_type => 'email', >+ is_digest => 1, >+ } >+ }); >+ C4::Members::Messaging::SetMessagingPreference({ >+ categorycode => $category->categorycode, >+ message_attribute_id => $attr->{'message_attribute_id'}, >+ message_transport_types => [ qw( email ) ], >+ days_in_advance => 5, >+ wants_digest => 1 >+ }); >+ my $default_messaging = $category->default_messaging; >+ is(@$default_messaging, 1, "One default messaging found."); >+ $default_messaging = $default_messaging->[0]; >+ is($default_messaging->{'message_attribute_id'}, $attr->{'message_attribute_id'}, "Default attribute id is correct."); >+ is($default_messaging->{'message_name'}, $attr->{'message_name'}, "Default message_name is correct."); >+ ok($default_messaging->{$attr->{'message_name'}}, "Found message_name as a key."); >+ is($default_messaging->{'transports'}->[0]->{'transport'}, "email", "Email found as transport type"); >+ $category->delete; # finally, delete the category in order not to fail last delete test >+}; >+ > $retrieved_category_1->delete; > is( Koha::Patron::Categories->search->count, $nb_of_categories + 1, 'Delete should have deleted the patron category' ); > >-- >2.7.4
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 18595
:
63435
|
63436
|
63437
|
63438
|
63439
|
63440
|
63441
|
63794
|
63795
|
63796
|
63797
|
63798
|
63799
|
63800
|
63813
|
63815
|
63816
|
63817
|
63818
|
63819
|
63820
|
63821
|
63822
|
63823
|
63824
|
63825
|
63826
|
63827
|
63828
|
63829
|
69441
|
69442
|
69443
|
69444
|
69445
|
69446
|
69447
|
69448
|
69449
|
69450
|
69451
|
69452
|
69453
|
69667
|
69668
|
69669
|
69670
|
69671
|
69672
|
69673
|
69674
|
93873
|
93874
|
93875
|
93876
|
93877
|
93878
|
93879
|
93880
|
93908
|
94753
|
94754
|
103444
|
103445
|
103446
|
103447
|
103448
|
103449
|
103450
|
103451
|
103452
|
110151
|
110152
|
110153
|
110154
|
110155
|
110156
|
110157
|
110158
|
110159
|
112147
|
112148
|
112149
|
112150
|
112151
|
112152
|
112153
|
112154
|
112155
|
112690
|
113126
|
113192
|
113221
|
113222
|
113769
|
146541
|
146542
|
146543
|
146544
|
146545
|
146546
|
146547
|
146548
|
146549
|
146550
|
146551
|
146552