Bugzilla – Attachment 62050 Details for
Bug 17047
Mana Knowledge Base : Data sharing
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 17047 Add unit tests
Bug-17047-Add-unit-tests.patch (text/plain), 5.56 KB, created by
Baptiste Wojtkowski (bwoj)
on 2017-04-11 14:14:17 UTC
(
hide
)
Description:
Bug 17047 Add unit tests
Filename:
MIME Type:
Creator:
Baptiste Wojtkowski (bwoj)
Created:
2017-04-11 14:14:17 UTC
Size:
5.56 KB
patch
obsolete
>From 294d2939b532c3f82c9ffb9f6fd9678110f667ff Mon Sep 17 00:00:00 2001 >From: morgane alonso <morgane.alonso@biblibre.com> >Date: Thu, 25 Aug 2016 14:35:59 +0000 >Subject: [PATCH] Bug 17047 Add unit tests > >--- > t/db_dependent/Koha/SharedContent.t | 29 ++++++++++ > t/db_dependent/Koha/Subscription.t | 111 ++++++++++++++++++++++++++++++++++++ > 2 files changed, 140 insertions(+) > create mode 100644 t/db_dependent/Koha/SharedContent.t > create mode 100644 t/db_dependent/Koha/Subscription.t > >diff --git a/t/db_dependent/Koha/SharedContent.t b/t/db_dependent/Koha/SharedContent.t >new file mode 100644 >index 0000000..3784028 >--- /dev/null >+++ b/t/db_dependent/Koha/SharedContent.t >@@ -0,0 +1,29 @@ >+#!/usr/bin/perl >+ >+# Copyright 2016 BibLibre Morgane Alonso >+# >+# This file is part of Koha >+# >+# Koha is free software; you can redistribute it and/or modify it >+# under the terms of the GNU General Public License as published by >+# the Free Software Foundation; either version 3 of the License, or >+# (at your option) any later version. >+# >+# Koha is distributed in the hope that it will be useful, but >+# WITHOUT ANY WARRANTY; without even the implied warranty of >+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the >+# GNU General Public License for more details. >+# >+# You should have received a copy of the GNU General Public License >+# along with Koha; if not, see <http://www.gnu.org/licenses>. >+ >+use Modern::Perl; >+ >+use t::lib::TestBuilder; >+use Test::More tests => 1; >+use Koha::Database; >+ >+use_ok('Koha::SharedContent'); >+ >+my $schema = Koha::Database->new->schema; >+$schema->storage->txn_begin; # mode insertion >diff --git a/t/db_dependent/Koha/Subscription.t b/t/db_dependent/Koha/Subscription.t >new file mode 100644 >index 0000000..4bde3b4 >--- /dev/null >+++ b/t/db_dependent/Koha/Subscription.t >@@ -0,0 +1,111 @@ >+#!/usr/bin/perl >+ >+# Copyright 2016 BibLibre Morgane Alonso >+# >+# This file is part of Koha >+# >+# Koha is free software; you can redistribute it and/or modify it >+# under the terms of the GNU General Public License as published by >+# the Free Software Foundation; either version 3 of the License, or >+# (at your option) any later version. >+# >+# Koha is distributed in the hope that it will be useful, but >+# WITHOUT ANY WARRANTY; without even the implied warranty of >+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the >+# GNU General Public License for more details. >+# >+# You should have received a copy of the GNU General Public License >+# along with Koha; if not, see <http://www.gnu.org/licenses>. >+ >+use Modern::Perl; >+ >+use t::lib::TestBuilder; >+use Test::More tests => 6; >+use Koha::Database; >+use Koha::Subscriptions; >+use Koha::Biblios; >+ >+use_ok('Koha::Subscription'); >+ >+my $schema = Koha::Database->new->schema; >+$schema->storage->txn_begin; >+my $builder = t::lib::TestBuilder->new; >+ >+my $nb_of_subs = Koha::Subscriptions->search->count; >+my $biblio_1 = $builder->build( { source => 'Biblio' } ); >+my $bi_1 = $builder->build( >+ { >+ source => 'Biblioitem', >+ value => { >+ biblionumber => $biblio_1->{biblionumber} >+ } >+ } >+); >+my $sub_freq_1 = $builder->build( { source => 'SubscriptionFrequency' } ); >+my $sub_np_1 = $builder->build( { source => 'SubscriptionNumberpattern' } ); >+my $sub_1 = $builder->build( >+ { >+ source => 'Subscription', >+ value => { >+ biblionumber => $biblio_1->{biblionumber}, >+ periodicity => $sub_freq_1->{id}, >+ numberpattern => $sub_np_1->{id} >+ } >+ } >+); >+ >+is( >+ Koha::Subscriptions->search->count, >+ $nb_of_subs + 1, >+ 'The subscription should have been added' >+); >+is( >+ $sub_1->{biblionumber}, >+ $biblio_1->{biblionumber}, >+ 'The link between sub and biblio is well done' >+); >+is( $sub_1->{periodicity}, $sub_freq_1->{id}, >+ 'The link between sub and sub_freq is well done' ); >+is( $sub_1->{numberpattern}, >+ $sub_np_1->{id}, >+ 'The link between sub and sub_numberpattern is well done' ); >+ >+my $ref = { >+ 'title' => $biblio_1->{title}, >+ 'notes' => $sub_1->{notes}, >+ 'sfdescription' => $sub_freq_1->{description}, >+ 'displayorder' => $sub_freq_1->{displayorder}, >+ 'unit' => $sub_freq_1->{unit}, >+ 'unitsperissue' => $sub_freq_1->{unitsperissue}, >+ 'issuesperunit' => $sub_freq_1->{issuesperunit}, >+ 'sndescription' => $sub_np_1->{description}, >+ 'numberingmethod' => $sub_np_1->{numberingmethod}, >+ 'label1' => $sub_np_1->{label1}, >+ 'add1' => $sub_np_1->{add1}, >+ 'every1' => $sub_np_1->{every1}, >+ 'whenmorethan1' => $sub_np_1->{whenmorethan1}, >+ 'setto1' => $sub_np_1->{setto1}, >+ 'numbering1' => $sub_np_1->{numbering1}, >+ 'label2' => $sub_np_1->{label2}, >+ 'add2' => $sub_np_1->{add2}, >+ 'every2' => $sub_np_1->{every2}, >+ 'whenmorethan2' => $sub_np_1->{whenmorethan2}, >+ 'setto2' => $sub_np_1->{setto2}, >+ 'numbering2' => $sub_np_1->{numbering2}, >+ 'label3' => $sub_np_1->{label3}, >+ 'add3' => $sub_np_1->{add3}, >+ 'every3' => $sub_np_1->{every3}, >+ 'whenmorethan3' => $sub_np_1->{whenmorethan3}, >+ 'setto3' => $sub_np_1->{setto3}, >+ 'numbering3' => $sub_np_1->{numbering3}, >+ 'issn' => $bi_1->{issn}, >+ 'ean' => $bi_1->{ean}, >+ 'publishercode' => $bi_1->{publishercode} >+}; >+ >+is_deeply( Koha::Subscription::get_sharable_info( $sub_1->{subscriptionid} ), >+ $ref, "get_sharable_info function is ok" ); >+ >+$schema->storage->txn_rollback; >+ >+1; >-- >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 17047
:
56175
|
56176
|
56177
|
56178
|
56179
|
56180
|
56181
|
59728
|
59729
|
59931
|
61905
|
62045
|
62046
|
62047
|
62048
|
62049
|
62050
|
62051
|
62052
|
62053
|
62054
|
62075
|
62465
|
62475
|
62485
|
62540
|
62542
|
62543
|
62544
|
62545
|
62546
|
62547
|
62548
|
62549
|
62550
|
62551
|
62552
|
62553
|
62589
|
62591
|
62592
|
62593
|
62594
|
62595
|
62596
|
62597
|
62598
|
62599
|
62603
|
62604
|
62605
|
62606
|
62607
|
62768
|
63476
|
63601
|
63618
|
63619
|
63620
|
63621
|
63622
|
63623
|
64484
|
64530
|
64618
|
64619
|
64620
|
64621
|
64622
|
64623
|
64624
|
64625
|
64626
|
64627
|
64628
|
64629
|
64630
|
64631
|
64632
|
64633
|
64634
|
64635
|
64636
|
64637
|
64638
|
64639
|
64640
|
64641
|
64642
|
64643
|
64648
|
64649
|
64650
|
64651
|
64652
|
64653
|
64654
|
64706
|
64962
|
65058
|
65059
|
65060
|
65061
|
65062
|
65063
|
65064
|
65065
|
65773
|
66667
|
66668
|
66987
|
67003
|
67004
|
67005
|
67006
|
67009
|
67010
|
67011
|
67012
|
67013
|
67014
|
67015
|
67016
|
67017
|
67018
|
67019
|
67020
|
67021
|
67022
|
67023
|
69034
|
69035
|
69036
|
69037
|
69038
|
69039
|
69040
|
69041
|
69091
|
70203
|
70204
|
70205
|
70206
|
70208
|
70209
|
70210
|
70211
|
70561
|
70874
|
72660
|
72661
|
72662
|
72663
|
72664
|
72665
|
72666
|
72667
|
72668
|
72669
|
72670
|
73699
|
73737
|
73738
|
73739
|
73740
|
73741
|
73742
|
73743
|
73744
|
73745
|
73746
|
73747
|
73748
|
73975
|
73976
|
73977
|
73978
|
73979
|
73980
|
73981
|
73982
|
73983
|
73984
|
73985
|
73986
|
76673
|
76674
|
76675
|
76676
|
76677
|
76678
|
76679
|
76680
|
76681
|
76682
|
76683
|
76684
|
78215
|
78216
|
78217
|
78218
|
78219
|
78220
|
78221
|
78222
|
78223
|
78224
|
78225
|
78226
|
78227
|
78228
|
78229
|
79868
|
79869
|
79870
|
79871
|
79872
|
79874
|
79877
|
79878
|
79879
|
79880
|
79881
|
79882
|
79883
|
79884
|
79885
|
79886
|
79887
|
79888
|
79922
|
79923
|
79924
|
79925
|
79926
|
79927
|
79928
|
79929
|
79930
|
79931
|
79932
|
79933
|
79934
|
79935
|
79936
|
79937
|
79938
|
79939
|
80183
|
80184
|
80185
|
80186
|
80187
|
80188
|
80189
|
80190
|
80191
|
80192
|
80193
|
80194
|
80195
|
80196
|
80197
|
80198
|
80199
|
80200
|
80471
|
80472
|
80473
|
80907
|
80908
|
80909
|
80910
|
80911
|
80912
|
80913
|
80914
|
80915
|
80916
|
80917
|
80918
|
80919
|
80920
|
80921
|
80922
|
80923
|
80924
|
81935
|
81936
|
81937
|
81938
|
81939
|
81940
|
81941
|
81942
|
81943
|
81944
|
81945
|
81946
|
81947
|
81948
|
81949
|
81950
|
81951
|
81952
|
81968
|
83863
|
83864
|
83865
|
83866
|
83867
|
83868
|
83869
|
83870
|
83871
|
83872
|
83873
|
83874
|
83875
|
83876
|
83877
|
83878
|
83879
|
83880
|
83881
|
83892
|
83893
|
83894
|
83895
|
83896
|
83897
|
83898
|
83899
|
83900
|
83901
|
83902
|
83903
|
83904
|
83905
|
83906
|
83907
|
83908
|
83909
|
83910
|
83911
|
83912
|
84142
|
84145
|
84210
|
84260
|
84261
|
84262
|
84263
|
84264
|
84265
|
84323
|
84324
|
84325
|
84326
|
84327
|
84328
|
84329
|
84332