Bugzilla – Attachment 59954 Details for
Bug 17944
Remove the sql code from itemtypes.pl administrative perl script
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 17944 - Implemented a subtest in the ItemTypes.t file for is_used function in ItemType.pm
Bug-17944---Implemented-a-subtest-in-the-ItemTypes.patch (text/plain), 2.09 KB, created by
Alex Buckley
on 2017-02-06 21:37:49 UTC
(
hide
)
Description:
Bug 17944 - Implemented a subtest in the ItemTypes.t file for is_used function in ItemType.pm
Filename:
MIME Type:
Creator:
Alex Buckley
Created:
2017-02-06 21:37:49 UTC
Size:
2.09 KB
patch
obsolete
>From 361eef9f15a249f8ad1a1a0a8ee4161324b17cc3 Mon Sep 17 00:00:00 2001 >From: Alex Buckley <alexbuckley@catalyst.net.nz> >Date: Sun, 29 Jan 2017 15:59:53 +0000 >Subject: [PATCH] Bug 17944 - Implemented a subtest in the ItemTypes.t file for > is_used function in ItemType.pm > >Test plan: >1. Go to t/db_dependent/Koha/ >2. Start koha-shell: sudo koha-shell <instancename> >3. Run the ItemTypes.t unit test: prove -v ItemTypes.t >4. Notice all tests are successful, and notice that the last two outputs >show the is_used subtest gave successful results >--- > t/db_dependent/Koha/ItemTypes.t | 17 ++++++++++------- > 1 file changed, 10 insertions(+), 7 deletions(-) > >diff --git a/t/db_dependent/Koha/ItemTypes.t b/t/db_dependent/Koha/ItemTypes.t >index 8417369..1064118 100755 >--- a/t/db_dependent/Koha/ItemTypes.t >+++ b/t/db_dependent/Koha/ItemTypes.t >@@ -19,7 +19,7 @@ > > use Modern::Perl; > >-use Test::More tests => 18; >+use Test::More tests => 20; > use Data::Dumper; > use Koha::Database; > use Koha::Items; >@@ -78,7 +78,7 @@ Koha::Item->new( > itemnumber => 1, > biblionumber => 1, > biblioitemnumber =>1, >- itype => 'type2', >+ itype => 'type1', > notforloan => 1, > itemlost => 0, > } >@@ -106,8 +106,8 @@ is( $type->checkinmsg, 'checkinmsg', 'checkinmsg' ); > is( $type->checkinmsgtype, 'checkinmsgtype', 'checkinmsgtype' ); > > >-subtest is_used => sub{ >- plan test => 2; >+sub is_used { >+ require Test::More; > my $itemtype_code = shift; > my $schema = Koha::Database->new()->schema(); > my $itemtotal = Koha::Items->search({ 'itype' => $itemtype_code })->count; >@@ -115,8 +115,11 @@ subtest is_used => sub{ > my $overalltotal = $itemtotal + $bibliototal; > return $overalltotal; > } >-for my $itemtype_code ('type1', 'type 2') { >- subtest "is_used $itemtype_code", \&is_used, $range; >-} >+my $passcount = is_used('type1'); >+is ( $passcount, 2, 'Exists in the database, test is successful'); >+ >+my $failcount = is_used('type2'); >+is ( $failcount, 0, 'Doesnt exist in database, test is success'); >+ > > $schema->txn_rollback; >-- >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 17944
:
59391
|
59564
|
59565
|
59655
|
59656
|
59657
|
59715
|
59716
|
59717
|
59718
|
59953
|
59954
|
62499
|
62500
|
62501
|
62502
|
62503
|
62504
|
62505
|
63045
|
63152
|
63220
|
63259
|
63307
|
63308
|
63309
|
63310
|
63924
|
63925