Bugzilla – Attachment 32287 Details for
Bug 12604
TestBuilder - Refactoring Category.t
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 12604: refactoring Category.t with TestBuilder
Bug-12604-refactoring-Categoryt-with-TestBuilder.patch (text/plain), 3.25 KB, created by
Marcel de Rooy
on 2014-10-13 11:47:43 UTC
(
hide
)
Description:
Bug 12604: refactoring Category.t with TestBuilder
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2014-10-13 11:47:43 UTC
Size:
3.25 KB
patch
obsolete
>From ae5ba4357b6f3e3592871c5c7c7a8dbfa6631e72 Mon Sep 17 00:00:00 2001 >From: Yohann Dufour <dufour.yohann@gmail.com> >Date: Fri, 18 Jul 2014 16:42:51 +0200 >Subject: [PATCH] Bug 12604: refactoring Category.t with TestBuilder >Content-Type: text/plain; charset=utf-8 > >The tests have been refactored with the module TestBuilder. > >Test plan: >1/ Apply the patch 12603 >2/ The command : prove t/db_dependent/Category.t has to be a success without error or warning : >t/db_dependent/Category.t .. ok >All tests successful. >Files=1, Tests=3, 1 wallclock secs ( 0.03 usr 0.01 sys + 1.05 cusr 0.05 csys = 1.14 CPU) >Result: PASS > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >--- > t/db_dependent/Category.t | 55 +++++++++++++++++++++++++++++++-------------- > 1 files changed, 38 insertions(+), 17 deletions(-) > >diff --git a/t/db_dependent/Category.t b/t/db_dependent/Category.t >index 21a0cf8..ebfeb26 100755 >--- a/t/db_dependent/Category.t >+++ b/t/db_dependent/Category.t >@@ -1,30 +1,51 @@ > #!/usr/bin/perl >+ >+# This file is part of Koha. >+# >+# Copyright 2014 - Koha Team >+# >+# 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. > # >-# This Koha test module is a stub! >-# Add more tests here!!! >+# 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 => 3; > >-use_ok('C4::Category'); >- >-use C4::Context; >-my $dbh = C4::Context->dbh; >-$dbh->{RaiseError} = 1; >-$dbh->{AutoCommit} = 0; >- >-my $sth=$dbh->prepare(' >- INSERT INTO categories( categorycode, description, enrolmentperiod, enrolmentperioddate, upperagelimit, dateofbirthrequired, enrolmentfee, reservefee, hidelostitems, overduenoticerequired, category_type ) >- VALUES (?,?,?,?,?,?,?,?,?,?,?) >-'); >+BEGIN { >+ use_ok('C4::Category'); >+} > >+my $builder = t::lib::TestBuilder->new(); > my $nonexistent_categorycode = 'NONEXISTEN'; >-$sth->execute($nonexistent_categorycode, "Desc", 12, "2014-01-02", 99, 1, 1.5, 2.5, 0, 0, "A") || die $sth->errstr; >+$builder->build({ >+ source => 'Category', >+ value => { >+ categorycode => $nonexistent_categorycode, >+ description => 'Desc', >+ enrolmentperiod => 12, >+ enrolementperioddate => '2014-01-02', >+ upperagelimit => 99, >+ dateofbirthrequired => 1, >+ enrolmentfee => 1.5, >+ reservefee => 2.5, >+ hidelostitems => 0, >+ overduenoticerequired => 0, >+ category_type => 'A', >+ }, >+}); >+ > my @categories = C4::Category->all; > ok( @categories, 'all returns categories' ); > > my $match = grep {$_->{categorycode} eq $nonexistent_categorycode } @categories; > is( $match, 1, 'all returns the inserted category'); >- >-$dbh->rollback; >-- >1.7.7.6
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 12604
:
29850
|
30088
| 32287