Bugzilla – Attachment 39219 Details for
Bug 14204
Fix t/db_dependent/Labels/t_Batch.t failing test from Bug 12911
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 14204: (QA followup) remove unneeded messages
Bug-14204-QA-followup-remove-unneeded-messages.patch (text/plain), 4.54 KB, created by
Mark Tompsett
on 2015-05-15 18:45:20 UTC
(
hide
)
Description:
Bug 14204: (QA followup) remove unneeded messages
Filename:
MIME Type:
Creator:
Mark Tompsett
Created:
2015-05-15 18:45:20 UTC
Size:
4.54 KB
patch
obsolete
>From 105852b8bff0787ba699351ba70abc2cd767c9d3 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@gmail.com> >Date: Fri, 15 May 2015 15:28:56 -0300 >Subject: [PATCH] Bug 14204: (QA followup) remove unneeded messages > >TEST PLAN >--------- >1) Apply first patch >2) prove -v t/db_dependent/Labels/t_Batch.t > -- YUCK! No meaningful messages on a lot of the ok's. >3) Apply this patch >4) prove -v t/db_dependent/Labels/t_Batch.t > -- YAY! Meaningful test results >5) koha qa test tools > >Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com> > >Signed-off-by: Mark Tompsett <mtompset@hotmail.com> >--- > t/db_dependent/Labels/t_Batch.t | 39 +++++++++++++++++++-------------------- > 1 file changed, 19 insertions(+), 20 deletions(-) > >diff --git a/t/db_dependent/Labels/t_Batch.t b/t/db_dependent/Labels/t_Batch.t >index 1fedec8..117a330 100644 >--- a/t/db_dependent/Labels/t_Batch.t >+++ b/t/db_dependent/Labels/t_Batch.t >@@ -36,10 +36,11 @@ my $dbh = C4::Context->dbh; > $dbh->{AutoCommit} = 0; > $dbh->{RaiseError} = 1; > >-my $sth = C4::Context->dbh->prepare('SELECT branchcode FROM branches b LIMIT 0,1'); >+my $sth = $dbh->prepare('SELECT branchcode FROM branches b LIMIT 0,1'); > $sth->execute(); > my $branch_code = $sth->fetchrow_hashref()->{'branchcode'}; > diag sprintf('Database returned the following error: %s', $sth->errstr) if $sth->errstr; >+ > my $expected_batch = { > creator => 'Labels', > items => [], >@@ -50,23 +51,23 @@ my $expected_batch = { > my $batch = 0; > my $item_number = 0; > >-diag "Testing Batch->new() method."; >-ok($batch = C4::Labels::Batch->new(branch_code => $branch_code)) || diag "Batch->new() FAILED."; >+# Testing Batch->new() method. >+ok($batch = C4::Labels::Batch->new(branch_code => $branch_code), "C4::Labels::Batch-->new() succeeds"); > my $batch_id = $batch->get_attr('batch_id'); > $expected_batch->{'batch_id'} = $batch_id; >-is_deeply($batch, $expected_batch) || diag "New batch object FAILED to verify."; >+is_deeply($batch, $expected_batch, "New batch object is correct."); > >-diag "Testing Batch->get_attr() method."; >+# Testing Batch->get_attr() method. > foreach my $key (keys %{$expected_batch}) { > if (ref($expected_batch->{$key}) eq 'ARRAY') { >- ok(ref($expected_batch->{$key}) eq ref($batch->get_attr($key))) || diag "Batch->get_attr() FAILED on attribute $key."; >+ ok(ref($expected_batch->{$key}) eq ref($batch->get_attr($key)), "Batch->get_attr() SUCCESS on attribute $key."); > } > else { >- ok($expected_batch->{$key} eq $batch->get_attr($key)) || diag "Batch->get_attr() FAILED on attribute $key."; >+ ok($expected_batch->{$key} eq $batch->get_attr($key), "Batch->get_attr() SUCCESS on attribute $key."); > } > } > >-diag "Testing Batch->add_item() method."; >+# Testing Batch->add_item() method. > # Create the item > my ( $f_holdingbranch, $sf_holdingbranch ) = GetMarcFromKohaField( 'items.holdingbranch' ); > my ( $f_homebranch, $sf_homebranch ) = GetMarcFromKohaField( 'items.homebranch' ); >@@ -92,25 +93,23 @@ my @iteminfo = C4::Items::AddItemBatchFromMarc( $record, $biblionumber, $biblioi > my $itemnumbers = $iteminfo[0]; > > for my $itemnumber ( @$itemnumbers ) { >- ok($batch->add_item($itemnumber) eq 0 ) || diag "Batch->add_item() FAILED."; >+ ok($batch->add_item($itemnumber) eq 0 , "Batch->add_item() success."); > } >-$batch_id=$batch->get_attr('batch_id'); >- >-diag "Testing Batch->retrieve() method."; >-ok(my $saved_batch = C4::Labels::Batch->retrieve(batch_id => $batch_id)) || diag "Batch->retrieve() FAILED."; >-is_deeply($saved_batch, $batch) || diag "Retrieved batch object FAILED to verify."; >+$batch_id = $batch->get_attr('batch_id'); > >-diag "Testing Batch->remove_item() method."; >+# Testing Batch->retrieve() method. >+ok(my $saved_batch = C4::Labels::Batch->retrieve(batch_id => $batch_id), "Batch->retrieve() success."); >+is_deeply($saved_batch, $batch, "Batch object retrieved correctly" ); > >+# Testing Batch->remove_item() method. > my $itemnumber = @$itemnumbers[0]; >-ok($batch->remove_item($itemnumber) eq 0) || diag "Batch->remove_item() FAILED."; >+ok($batch->remove_item($itemnumber) eq 0, "Batch->remove_item() success."); > > my $updated_batch = C4::Labels::Batch->retrieve(batch_id => $batch_id); >-is_deeply($updated_batch, $batch) || diag "Updated batch object FAILED to verify."; >- >-diag "Testing Batch->delete() method."; >+is_deeply($updated_batch, $batch, "Updated batch object is correct."); > >+# Testing Batch->delete() method. > my $del_results = $batch->delete(); >-ok($del_results eq 0) || diag "Batch->delete() FAILED."; >+ok($del_results eq 0, "Batch->delete() success."); > > $dbh->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 14204
:
39203
|
39213
|
39217
|
39218
| 39219