Bugzilla – Attachment 79455 Details for
Bug 17674
Allow UI to delete serials issues in batch
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 17674: Add unit tests
Bug-17674-Add-unit-tests.patch (text/plain), 4.40 KB, created by
Michal Denar
on 2018-09-26 19:41:36 UTC
(
hide
)
Description:
Bug 17674: Add unit tests
Filename:
MIME Type:
Creator:
Michal Denar
Created:
2018-09-26 19:41:36 UTC
Size:
4.40 KB
patch
obsolete
>From 1f3ef04caf0ac2b66522aaee95d87f810f2b6e6b Mon Sep 17 00:00:00 2001 >From: Bouzid Fergani <bouzid.fergani@inlibro.com> >Date: Fri, 16 Dec 2016 10:44:46 -0500 >Subject: [PATCH] Bug 17674: Add unit tests >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >https://bugs.koha-community.org/show_bug.cgi?id=17674 > >Signed-off-by: Sonia BOUIS <sonia.bouis@univ-lyon3.fr> >Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr> >Signed-off-by: Michal Denar <black23@gmail.com> > >Signed-off-by: Michal Denar <black23@gmail.com> >--- > t/db_dependent/Serials.t | 47 ++++++++++++++++++++++++++++++++++++++++++++++- > 1 file changed, 46 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/Serials.t b/t/db_dependent/Serials.t >index 4c0f56a..57bec17 100755 >--- a/t/db_dependent/Serials.t >+++ b/t/db_dependent/Serials.t >@@ -17,13 +17,14 @@ use C4::Items; > use Koha::DateUtils; > use Koha::Acquisition::Booksellers; > use t::lib::Mocks; >+use Test::More tests => 50; > use t::lib::TestBuilder; >-use Test::More tests => 46; > > BEGIN { > use_ok('C4::Serials'); > } > >+my $builder = t::lib::TestBuilder->new; > my $dbh = C4::Context->dbh; > > # Start transaction >@@ -348,6 +349,50 @@ subtest "Do not generate an expected if one already exists" => sub { > is( @serialsByStatus, 1, "ModSerialStatus delete corectly serial expected and not create another if exists" ); > }; > >+subtest "Test GetSerialItemsInformations " => sub { >+ plan tests => 4; >+ is (C4::Serials::GetSerialItemsInformations(),0,"test GetSerialItemsInformation with nothing parameters "); >+ my $branchcode = $builder->build({ source => 'Branch' })->{ branchcode }; >+ my $itemtype = $builder->build({ source => 'Itemtype' })->{ itemtype }; >+ my %item_infos = ( >+ homebranch => $branchcode, >+ holdingbranch => $branchcode, >+ itype => $itemtype >+ ); >+ my $biblionumber1 = AddBiblio(MARC::Record->new, ''); >+ my $itemnumber1 = AddItem({ barcode => '0101', %item_infos }, $biblionumber1); >+ my $itemnumber2 = AddItem({ barcode => '0102', %item_infos }, $biblionumber1); >+ my $itemnumber3 = AddItem({ barcode => '0103', %item_infos }, $biblionumber1); >+ my $itemnumber4 = AddItem({ barcode => '0104', %item_infos }, $biblionumber1); >+ my @serialid = ($serials[0]->{serialid},$serials[1]->{serialid}); >+ is (C4::Serials::GetSerialItemsInformations(@serialid),0,"test GetSerialItemsInformation with array of serialid and none have items"); >+ subtest "Test with 2 serials and each have one item" => sub { >+ plan tests => 5; >+ AddItem2Serial($serialid[0],$itemnumber1); >+ my @result = C4::Serials::GetSerialItemsInformations(@serialid); >+ is (scalar @result, 1 , "GetSerialItemsInformation return right length of array using 1 serial with 1 item"); >+ is (@result[0]->{countitems}, 1 , "GetSerialItemsInformation return right number items of serial1"); >+ AddItem2Serial($serialid[1],$itemnumber3); >+ @result = C4::Serials::GetSerialItemsInformations(@serialid); >+ is (scalar @result, 2 , "GetSerialItemsInformation return right length of array using 2 serials and each have 1 item"); >+ is (@result[0]->{countitems}, 1 , "GetSerialItemsInformation return right number items of serial1"); >+ is (@result[1]->{countitems}, 1 , "GetSerialItemsInformation return right number items of serial2"); >+ }; >+ subtest "Test with 2 serials and each have 2 items" => sub { >+ plan tests => 6; >+ AddItem2Serial($serialid[0],$itemnumber2); >+ my @result = C4::Serials::GetSerialItemsInformations(@serialid); >+ is (scalar @result, 2 , "GetSerialItemsInformation return right length of array using 2 serials "); >+ is (@result[0]->{countitems}, 2 , "GetSerialItemsInformation return right number items of serial1"); >+ is (@result[1]->{countitems}, 1 , "GetSerialItemsInformation return right number items of serial2"); >+ AddItem2Serial($serialid[1],$itemnumber4); >+ @result = C4::Serials::GetSerialItemsInformations(@serialid); >+ is (scalar @result, 2 , "GetSerialItemsInformation return right length of array using 2 serials and each have 2 items "); >+ is (@result[0]->{countitems}, 2 , "GetSerialItemsInformation return right number items of serial1"); >+ is (@result[1]->{countitems}, 2 , "GetSerialItemsInformation return right number items of serial2"); >+ }; >+}; >+ > $dbh->rollback; > > sub get_biblio { >-- >2.1.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 17674
:
57731
|
58262
|
58263
|
58264
|
60925
|
61314
|
61315
|
61316
|
66565
|
69007
|
69010
|
69011
|
69013
|
69976
|
69977
|
69978
|
69979
|
71865
|
71866
|
71867
|
71868
|
71869
|
72985
|
73032
|
73035
|
73036
|
73037
|
73038
|
73039
|
73040
|
74318
|
74359
|
74472
|
75643
|
75644
|
75645
|
75646
|
75647
|
75648
|
75649
|
77745
|
77746
|
77747
|
77748
|
77749
|
77750
|
77751
|
77861
|
77862
|
77863
|
77864
|
77865
|
77866
|
77867
|
77868
|
79415
|
79420
|
79421
|
79422
|
79423
|
79424
|
79425
|
79426
|
79427
|
79428
|
79453
|
79454
|
79455
|
79456
|
79457
|
79458
|
79459
|
79460
|
80859
|
80944
|
80955
|
82237
|
86689
|
95474
|
99434
|
99944
|
99945
|
100906
|
100907