Bugzilla – Attachment 20460 Details for
Bug 10761
UT: saved_report and delete_report in C4::Reports::Report_Guided.pm need unit tests.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 10761:UT:save_report and delete_report in C4::Reports::Report_Guided.pm need unit tests
Bug-10761UTsavereport-and-deletereport-in-C4Report.patch (text/plain), 2.77 KB, created by
kenza
on 2013-08-19 13:34:58 UTC
(
hide
)
Description:
Bug 10761:UT:save_report and delete_report in C4::Reports::Report_Guided.pm need unit tests
Filename:
MIME Type:
Creator:
kenza
Created:
2013-08-19 13:34:58 UTC
Size:
2.77 KB
patch
obsolete
>From 309dd7d67868875be355788fcf18ad2f4c729243 Mon Sep 17 00:00:00 2001 >From: Kenza Zaki <kenza.zaki@biblibre.com> >Date: Mon, 19 Aug 2013 15:20:59 +0200 >Subject: [PATCH] Bug 10761:UT:save_report and delete_report in > C4::Reports::Report_Guided.pm need unit tests > >The test are wrap in a transaction. > >Note : The last test (in comment) currently doesn't pass because it needs some modifications of delete_report. > >To test: >prove t/db_dependent/Reports_Guided.t >t/db_dependent/Reports_Guided.t .. ok >All tests successful. >Files=1, Tests=7, 0 wallclock secs ( 0.01 usr 0.01 sys + 0.28 cusr 0.02 csys = 0.32 CPU) >Result: PASS >--- > t/db_dependent/Reports_Guided.t | 47 ++++++++++++++++++++++++++++++++++----- > 1 file changed, 42 insertions(+), 5 deletions(-) > >diff --git a/t/db_dependent/Reports_Guided.t b/t/db_dependent/Reports_Guided.t >index 0b0cda6..ecc9fff 100755 >--- a/t/db_dependent/Reports_Guided.t >+++ b/t/db_dependent/Reports_Guided.t >@@ -1,14 +1,51 @@ > #!/usr/bin/perl > # >-# This Koha test module is a stub! >+# This Koha test module is a stub! > # Add more tests here!!! > >-use strict; >-use warnings; >+use Modern::Perl; > >-use Test::More tests => 1; >+use Test::More tests => 7; >+ >+use C4::Context; > > BEGIN { >- use_ok('C4::Reports::Guided'); >+ use_ok('C4::Reports::Guided'); > } >+can_ok( 'C4::Reports::Guided', >+ qw(save_report >+ delete_report) >+); >+ >+#Start transaction >+my $dbh = C4::Context->dbh; >+$dbh->{RaiseError} = 1; >+$dbh->{AutoCommit} = 0; >+ >+$dbh->do(q|DELETE FROM saved_sql|); >+ >+#Start tests >+ >+#Test save_report >+my $count = scalar (keys get_saved_reports()); >+is ($count , 0, "There is no report"); >+my $sample_report1 = {borrowernumber => 1,savedsql => 'SQL1',name => 'Name1' , >+area => 'area1' ,group => 'group1' ,subgroup => 'subgroup1',type => 'type1',notes => 'note1',cache_expiry => 'null' ,public => 'null'}; >+my $sample_report2 = {borrowernumber => 2,savedsql => 'SQL2',name => 'Name2' , >+area => 'area2' ,group => 'group2' ,subgroup => 'subgroup2',type => 'type2',notes => 'note2',cache_expiry => 'null' ,public => 'null'}; >+my $report_id1 = save_report($sample_report1); >+my $report_id2 = save_report($sample_report2); >+like($report_id1,'/^\d+$/',"Save_report returns an id"); >+like($report_id2,'/^\d+$/',"Save_report returns an id"); >+is ( scalar (keys get_saved_reports()),$count + 2 , "Report1 and report2 have been added"); >+ >+#Test delete_report >+#It would be better if delete_report has return values >+delete_report($report_id1,$report_id2); >+is ( scalar (keys get_saved_reports()),$count , "Report1 and report2 have been deleted"); >+#FIX ME: Currently, this test doesn't pass because delete_report doesn't test if one or more parameters are given >+#is (deleted_report(),undef, "Without id deleted_report returns undef"); >+ >+#End transaction >+$dbh->rollback; > >-- >1.7.9.5
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 10761
:
20460
|
20464
|
20515
|
20530
|
20531