Bugzilla – Attachment 44063 Details for
Bug 14468
Remove warnings when creating Labels
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 14468: (QA followup) remove useless diags
Bug-14468-QA-followup-remove-useless-diags.patch (text/plain), 8.61 KB, created by
Tomás Cohen Arazi (tcohen)
on 2015-10-27 13:41:28 UTC
(
hide
)
Description:
Bug 14468: (QA followup) remove useless diags
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2015-10-27 13:41:28 UTC
Size:
8.61 KB
patch
obsolete
>From d1a2061720f7e497bf9eda42f0b409e5e3caf391 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Tue, 27 Oct 2015 10:35:02 -0300 >Subject: [PATCH] Bug 14468: (QA followup) remove useless diags > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > t/db_dependent/Labels/t_Profile.t | 45 ++++++++++++++++--------------- > t/db_dependent/Labels/t_Template.t | 55 ++++++++++++++++++++------------------ > 2 files changed, 52 insertions(+), 48 deletions(-) > >diff --git a/t/db_dependent/Labels/t_Profile.t b/t/db_dependent/Labels/t_Profile.t >index d35b44d..e918ca4 100644 >--- a/t/db_dependent/Labels/t_Profile.t >+++ b/t/db_dependent/Labels/t_Profile.t >@@ -17,12 +17,10 @@ > # You should have received a copy of the GNU General Public License > # along with Koha; if not, see <http://www.gnu.org/licenses>. > >-use strict; >-use warnings; >+use Modern::Perl; > > use Test::More tests => 27; > use C4::Context; >-use Data::Dumper; > > BEGIN { > use_ok('C4::Labels::Profile'); >@@ -42,16 +40,17 @@ my $expected_profile = { > > my $err = 0; > >-diag "Testing Profile->new() method."; >-ok(my $profile = C4::Labels::Profile->new(printer_name => 'Circulation Desk',paper_bin => 'bypass')) || diag"Profile->new() FAILED."; >-is_deeply($profile, $expected_profile) || diag "New profile object FAILED to verify."; >+# Testing Profile->new() >+ok(my $profile = C4::Labels::Profile->new(printer_name => 'Circulation Desk',paper_bin => 'bypass'), "Profile->new() success"); >+is_deeply($profile, $expected_profile, "New profile object verify success"); > >-diag "Testing Profile->get_attr() method."; >+# Testing Profile->get_attr() > foreach my $key (keys %{$expected_profile}) { >- ok($expected_profile->{$key} eq $profile->get_attr($key)) || diag "Profile->get_attr() FAILED on attribute $key."; >+ ok($expected_profile->{$key} eq $profile->get_attr($key), >+ "Profile->get_attr() success on attribute $key"); > } > >-diag "Testing Profile->set_attr() method."; >+# Testing Profile->set_attr() > my $new_attr = { > printer_name => 'Cataloging Desk', > template_id => '1', >@@ -66,32 +65,34 @@ my $new_attr = { > > foreach my $key (keys %{$new_attr}) { > $err = $profile->set_attr($key, $new_attr->{$key}); >- ok(($new_attr->{$key} eq $profile->get_attr($key)) && ($err lt 1)) || diag "Profile->set_attr() FAILED on attribute $key."; >+ ok(($new_attr->{$key} eq $profile->get_attr($key)) && ($err lt 1), >+ "Profile->set_attr() success on attribute $key"); > } > >-diag "Testing Profile->save() method with a new object."; >- >+# Testing Profile->save()with a new object > my $sav_results = $profile->save(); >-ok($sav_results ne -1) || diag "Profile->save() FAILED."; >+ok($sav_results ne -1, "Profile->save() success"); > > my $saved_profile; > if ($sav_results ne -1) { >- diag "Testing Profile->retrieve() method."; >+ # Testing Profile->retrieve() > $new_attr->{'profile_id'} = $sav_results; >- ok($saved_profile = C4::Labels::Profile->retrieve(profile_id => $sav_results)) || diag "Profile->retrieve() FAILED."; >- is_deeply($saved_profile, $new_attr) || diag "Retrieved profile object FAILED to verify."; >+ ok($saved_profile = C4::Labels::Profile->retrieve(profile_id => $sav_results), >+ "Profile->retrieve() success"); >+ is_deeply($saved_profile, $new_attr, "Retrieved profile object verify success"); > } > >-diag "Testing Profile->save() method with an updated object."; >+# Testing Profile->save() with an updated object > > $err = 0; # Reset error code > $err = $saved_profile->set_attr(units => 'CM'); > my $upd_results = $saved_profile->save(); >-ok(($upd_results ne -1) && ($err lt 1)) || diag "Profile->save() FAILED."; >+ok(($upd_results ne -1) && ($err lt 1), "Profile->save() success"); > my $updated_profile = C4::Labels::Profile->retrieve(profile_id => $sav_results); >-is_deeply($updated_profile, $saved_profile) || diag "Updated layout object FAILED to verify."; >- >-diag "Testing Profile->delete() method."; >+is_deeply($updated_profile, $saved_profile, "Updated layout object verify success"); > >+# Testing Profile->delete() > my $del_results = $updated_profile->delete(); >-ok($del_results ne -1) || diag "Profile->delete() FAILED."; >+ok($del_results ne -1, "Profile->delete() success"); >+ >+1; >diff --git a/t/db_dependent/Labels/t_Template.t b/t/db_dependent/Labels/t_Template.t >index f1ad57f..0eb6871 100644 >--- a/t/db_dependent/Labels/t_Template.t >+++ b/t/db_dependent/Labels/t_Template.t >@@ -17,12 +17,10 @@ > # You should have received a copy of the GNU General Public License > # along with Koha; if not, see <http://www.gnu.org/licenses>. > >-use strict; >-use warnings; >+use Modern::Perl; > > use Test::More tests => 54; > use C4::Context; >-use Data::Dumper; > > BEGIN { > use_ok('C4::Labels::Template'); >@@ -51,16 +49,18 @@ my $expect_template = { > > my $template; > >-diag "Testing Template->new() method."; >-ok($template = C4::Labels::Template->new(page_width => 8.5,cols => 3)) || diag "Template->new() FAILED."; >-is_deeply($template, $expect_template) || diag "New template object FAILED to verify."; >+# Testing Template->new() >+ok($template = C4::Labels::Template->new(page_width => 8.5,cols => 3), >+ "Template->new() success."); >+is_deeply($template, $expect_template, "New template object verify success"); > >-diag "Testing Template->get_attr() method."; >+# Testing Template->get_attr() > foreach my $key (keys %{$expect_template}) { >- ok($expect_template->{$key} eq $template->get_attr($key)) || diag "Template->get_attr() FAILED on attribute $key."; >+ ok($expect_template->{$key} eq $template->get_attr($key), >+ "Template->get_attr() success on attribute $key"); > } > >-diag "Testing Template->set_attr() method."; >+# Testing Template->set_attr() > my $new_attr = { > creator => 'Labels', > profile_id => 0, >@@ -85,32 +85,32 @@ my $new_attr = { > foreach my $key (keys %{$new_attr}) { > next if ($key eq 'template_stat'); > $template->set_attr($key, $new_attr->{$key}); >- ok($new_attr->{$key} eq $template->get_attr($key)) || diag "Template->set_attr() FAILED on attribute $key."; >+ ok($new_attr->{$key} eq $template->get_attr($key), >+ "Template->set_attr() success on attribute $key"); > } > >-diag "Testing Template->save() method with a new object."; >- >+# Testing Template->save() with a new object > my $sav_results = $template->save(); >-ok($sav_results ne -1) || diag "Template->save() FAILED."; >+ok($sav_results ne -1, "Template->save() success"); > > my $saved_template; > if ($sav_results ne -1) { >- diag "Testing Template->retrieve() method."; >+ # Testing Template->retrieve() > $new_attr->{'template_id'} = $sav_results; >- ok($saved_template = C4::Labels::Template->retrieve(template_id => $sav_results)) || diag "Template->retrieve() FAILED."; >- is_deeply($saved_template, $new_attr) || diag "Retrieved template object FAILED to verify."; >+ ok($saved_template = C4::Labels::Template->retrieve(template_id => $sav_results), >+ "Template->retrieve() success"); >+ is_deeply($saved_template, $new_attr, >+ "Retrieved template object verify success"); > } > >-diag "Testing Template->save method with an updated object."; >- >+# Testing Template->save with an updated object > $saved_template->set_attr(template_desc => 'A test template'); > my $upd_results = $saved_template->save(); >-ok($upd_results ne -1) || diag "Template->save() FAILED."; >+ok($upd_results ne -1, "Template->save() success"); > my $updated_template = C4::Labels::Template->retrieve(template_id => $sav_results); >-is_deeply($updated_template, $saved_template) || diag "Updated template object FAILED to verify."; >- >-diag "Testing Template->retrieve() convert points option."; >+is_deeply($updated_template, $saved_template, "Updated template object verify success"); > >+# Testing Template->retrieve() convert points option > my $conv_template = C4::Labels::Template->retrieve(template_id => $sav_results, convert => 1); > my $expect_conv = { > page_width => 612, >@@ -126,10 +126,13 @@ my $expect_conv = { > }; > > foreach my $key (keys %{$expect_conv}) { >- ok($expect_conv->{$key} eq $conv_template->get_attr($key)) || diag "Template->retrieve() convert points option FAILED. Expected " . $expect_conv->{$key} . " but got " . $conv_template->get_attr($key) . "."; >+ ok($expect_conv->{$key} eq $conv_template->get_attr($key), >+ "Template->retrieve() convert points option success ($expect_conv->{$key})") >+ || diag("Expected " . $expect_conv->{$key} . " but got " . $conv_template->get_attr($key) . "."); > } > >-diag "Testing Template->delete() method."; >- >+# Testing Template->delete() > my $del_results = $updated_template->delete(); >-ok($del_results ne -1) || diag "Template->delete() FAILED."; >+ok($del_results ne -1, "Template->delete() success"); >+ >+1; >-- >2.6.2
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 14468
:
40699
|
40741
|
41375
|
43882
|
44015
|
44045
| 44063