Bugzilla – Attachment 61008 Details for
Bug 18212
Move SQL code from aqplan.pl administrative script into Koha directory perl modules
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 18212 - Added a successful unit test for GetAuthValues() function
Bug-18212---Added-a-successful-unit-test-for-GetAu.patch (text/plain), 1.90 KB, created by
Alex Buckley
on 2017-03-10 23:01:28 UTC
(
hide
)
Description:
Bug 18212 - Added a successful unit test for GetAuthValues() function
Filename:
MIME Type:
Creator:
Alex Buckley
Created:
2017-03-10 23:01:28 UTC
Size:
1.90 KB
patch
obsolete
>From 787035e523bc752822a67a642999e47e032126f0 Mon Sep 17 00:00:00 2001 >From: Alex Buckley <alexbuckley@catalyst.net.nz> >Date: Fri, 10 Mar 2017 03:14:58 +0000 >Subject: [PATCH] Bug 18212 - Added a successful unit test for GetAuthValues() > function > >--- > t/db_dependent/AuthorisedValues.t | 39 ++++++++++++++++++++++++++++++++++++++- > 1 file changed, 38 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/AuthorisedValues.t b/t/db_dependent/AuthorisedValues.t >index 6d44a72..e7403ff 100644 >--- a/t/db_dependent/AuthorisedValues.t >+++ b/t/db_dependent/AuthorisedValues.t >@@ -1,7 +1,7 @@ > #!/usr/bin/perl > > use Modern::Perl; >-use Test::More tests => 15; >+use Test::More tests => 16; > > use C4::Context; > use Koha::AuthorisedValue; >@@ -225,3 +225,40 @@ subtest 'search_by_*_field + find_by_koha_field + get_description' => sub { > ); > }; > }; >+ sub GetAuthValues { >+ require Test::More; >+ my $dbh = C4::Context->dbh; >+ my ($self, $authcat) = @_; >+ my $query = qq{ SELECT * FROM authorised_values WHERE category=? order by lib }; >+ my $sth = $dbh->prepare($query); >+ $sth->execute($authcat); >+ my $AuthValue = 0; >+ if ($sth->rows > 0) { >+ $AuthValue = 1; >+ } >+ return $AuthValue; >+ }; >+ my $AuthValues = GetAuthValues('av_for_testing'); >+ is ( $AuthValues,0, 'Does not exist in the database: Test successful'); >+ >+ sub GetDistinctCat { >+ require Test::More; >+ my $dbh = C4::Context->dbh; >+ my ($self, $dbh) = @_; >+ my $sth = $dbh->prepare("select distinct category from authorised_values where category like 'A%' "); >+ $sth->execute; >+ return $sth; >+ my $DistAuth = 0; >+ if ($sth->rows > 0){ >+ $DistAuth = 1; >+ } >+ return $DistAuth; >+ }; >+ my $DistAuth = GetDistinctCat(); >+ is ( $DistAuth, 0, 'Does not exist in the database successful'); >+ >+ >+ >+ >+ >+ >-- >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 18212
:
61006
|
61007
|
61008
|
61009
|
62584
|
62585
|
62587
|
62588
|
66567
|
66570
|
66571