Bugzilla – Attachment 44881 Details for
Bug 15152
t/db_dependent/Reports_Guided.t should not depend on existing data
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 15152: t/db_dependent/Reports_Guided.t should not depend on existing data
Bug-15152-tdbdependentReportsGuidedt-should-not-de.patch (text/plain), 2.46 KB, created by
Tomás Cohen Arazi (tcohen)
on 2015-11-16 18:33:54 UTC
(
hide
)
Description:
Bug 15152: t/db_dependent/Reports_Guided.t should not depend on existing data
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2015-11-16 18:33:54 UTC
Size:
2.46 KB
patch
obsolete
>From 120da0075306eb76ddd8a99c98e85ef2e09a9e6f Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Mon, 16 Nov 2015 15:25:26 -0300 >Subject: [PATCH] Bug 15152: t/db_dependent/Reports_Guided.t should not depend > on existing data > >The current implementation relies on existing borrowers on the DB. >Even when the DB itself doesn't have a FK constraint, the function >that retrieves the reports from the DB relies on get_saved_reports_base_query >which creates a query that JOINs the full query with the 'borrowers' table, on >the borrowernumber. So it is doomed to fail on some scenarios. >Specially because the current tests expect specific borrowernumber values >to be present (1, 2 and 3). > >To test: >[To set the failure scenario] > $ vagrant up jessie > $ vagrant ssh jessie > $ wget https://theke.io/static/reports_guided_sequence.txt -O /vagrant/reports_guided_sequence.txt > $ wget https://theke.io/static/koha_3_20_00.sql.gz -O /vagrant/koha_3_20_00.sql.gz > $ sudo -s > $ mysql > > DROP DATABASE koha_kohadev; CREATE DATABASE koha_kohadev; \q > $ zcat /vagrant/koha_3_20_00.sql.gz | mysql koha_kohadev > $ exit > $ sudo koha-shell kohadev > $ cd kohaclone > $ cat /vagrant/reports_guided_sequence.txt | xargs prove > >- now run the tests: > $ prove t/db_dependent/Reports_Guided.t >=> FAIL: The tests fail > >- Apply the patch >- [re create the scenario] >- Run the test: > $ prove t/db_dependent/Reports_Guided.t >=> SUCCESS: Tests now pass >- Sign off :-D > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > t/db_dependent/Reports_Guided.t | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/Reports_Guided.t b/t/db_dependent/Reports_Guided.t >index 649e33a..e48a8a9 100755 >--- a/t/db_dependent/Reports_Guided.t >+++ b/t/db_dependent/Reports_Guided.t >@@ -19,6 +19,7 @@ use Modern::Perl; > > use Test::More tests => 18; > use Test::Warn; >+use t::lib::TestBuilder; > > use C4::Context; > use Koha::Database; >@@ -33,6 +34,7 @@ can_ok( > > my $schema = Koha::Database->new->schema; > $schema->storage->txn_begin; >+my $builder = t::lib::TestBuilder->new; > > my $dbh = C4::Context->dbh; > $dbh->do(q|DELETE FROM saved_sql|); >@@ -45,7 +47,8 @@ my $count = scalar( @{ get_saved_reports() } ); > is( $count, 0, "There is no report" ); > > my @report_ids; >-for my $id ( 1 .. 3 ) { >+foreach ( 1..3 ) { >+ my $id = $builder->build({ source => 'Borrower' })->{ borrowernumber }; > push @report_ids, save_report({ > borrowernumber => $id, > sql => "SQL$id", >-- >2.6.3
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 15152
:
44577
|
44590
|
44881
|
44884