Bugzilla – Attachment 43873 Details for
Bug 14778
DBIC should create/own the DB handler
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
[PASSED QA] Bug 14778: Install fixtures for t/SocialData.t
PASSED-QA-Bug-14778-Install-fixtures-for-tSocialDa.patch (text/plain), 2.93 KB, created by
Kyle M Hall (khall)
on 2015-10-23 14:57:09 UTC
(
hide
)
Description:
[PASSED QA] Bug 14778: Install fixtures for t/SocialData.t
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2015-10-23 14:57:09 UTC
Size:
2.93 KB
patch
obsolete
>From 6ac23d53e388cb25314b4a6c15df8af8cc4d807f Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Tue, 20 Oct 2015 14:21:45 +0100 >Subject: [PATCH] [PASSED QA] Bug 14778: Install fixtures for t/SocialData.t > >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >--- > t/SocialData.t | 64 +++++++++++++++++++++++++++---------------------------- > 1 files changed, 31 insertions(+), 33 deletions(-) > >diff --git a/t/SocialData.t b/t/SocialData.t >index 06705a5..3d6cd1a 100644 >--- a/t/SocialData.t >+++ b/t/SocialData.t >@@ -2,51 +2,49 @@ > # > #Testing C4 SocialData > >-use strict; >-use warnings; >-use Test::More tests => 5; >+use Modern::Perl; >+use Test::More tests => 6; > use Test::MockModule; > > BEGIN { > use_ok('C4::SocialData'); > } > >-my $module = new Test::MockModule('C4::Context'); >-$module->mock( >- '_new_dbh', >- sub { >- my $dbh = DBI->connect( 'DBI:Mock:', '', '' ) >- || die "Cannot create handle: $DBI::errstr\n"; >- return $dbh; >- } >-); >-my $socialdata = [ >- [ >- 'isbn', 'num_critics', >- 'num_critics_pro', 'num_quotations', >- 'num_videos', 'score_avg', >- 'num_scores' >+use Test::DBIx::Class { >+ schema_class => 'Koha::Schema', >+ connect_info => ['dbi:SQLite:dbname=:memory:','',''], >+ connect_opts => { name_sep => '.', quote_char => '`', }, >+ fixture_class => '::Populate', >+}, 'SocialData', 'Biblioitem' ; >+ >+fixtures_ok [ >+ Biblioitem => [ >+ ['biblionumber', 'isbn'], >+ [1, '0-596-52674-1'], >+ [2, '0-596-00289-0'], > ], >- [ '0-596-52674-1', 1, 2, 3, 4, 5.2, 6 ], >- [ '0-596-00289-0', 2, 3, 4, 5, 6.2, 7 ] >-]; >-my $dbh = C4::Context->dbh(); >+ SocialData => [ >+ [ >+ 'isbn', 'num_critics', >+ 'num_critics_pro', 'num_quotations', >+ 'num_videos', 'score_avg', >+ 'num_scores' >+ ], >+ [ '0-596-52674-1', 1, 2, 3, 4, 5.2, 6 ], >+ [ '0-596-00289-0', 2, 3, 4, 5, 6.2, 7 ] >+ ], >+], 'add fixtures'; > >-$dbh->{mock_add_resultset} = $socialdata; >+my $db = Test::MockModule->new('Koha::Database'); >+$db->mock( _new_schema => sub { return Schema(); } ); > > my $data = C4::SocialData::get_data(); >+is( $data, undef, 'get_data should return undef if no param given'); > >-is( $data->{'isbn'}, '0-596-52674-1', 'First isbn is 0-596-52674-1' ); >- >-my $reportdata = >- [ [ 'biblionumber', 'isbn' ], [ 1, '0-596-52674-1' ], >- [ 2, '0-596-00289-0' ] ]; >- >-use Data::Dumper; >- >-$dbh->{mock_add_resultset} = $reportdata; >+$data = C4::SocialData::get_data('0-596-52674-1'); >+is( $data->{isbn}, '0-596-52674-1', 'get_data should return the matching row'); > >-ok( my $report = C4::SocialData::get_report() ); >+my $report = C4::SocialData::get_report('0-596-52674-1'); > > is( $report->{'without'}->[0]->{'original'}, > '0-596-52674-1', 'testing get_report gives isbn' ); >-- >1.7.2.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 14778
:
42326
|
42388
|
43247
|
43248
|
43249
|
43250
|
43440
|
43631
|
43632
|
43633
|
43634
|
43635
|
43636
|
43637
|
43638
|
43639
|
43640
|
43641
|
43642
|
43643
|
43644
|
43645
|
43834
|
43835
|
43836
|
43837
|
43838
|
43839
|
43840
|
43841
|
43842
|
43843
|
43844
|
43845
|
43846
|
43847
|
43848
|
43849
|
43850
|
43851
|
43852
|
43853
|
43857
|
43858
|
43859
|
43860
|
43861
|
43862
|
43863
|
43864
|
43865
|
43866
|
43867
|
43868
|
43869
|
43870
|
43871
|
43872
| 43873 |
43874
|
43875
|
43876
|
44003