Bugzilla – Attachment 43848 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]
Bug 14778: Install fixtures for t/Matcher.t
Bug-14778-Install-fixtures-for-tMatchert.patch (text/plain), 2.17 KB, created by
Martin Renvoize (ashimema)
on 2015-10-23 14:08:24 UTC
(
hide
)
Description:
Bug 14778: Install fixtures for t/Matcher.t
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2015-10-23 14:08:24 UTC
Size:
2.17 KB
patch
obsolete
>From 775357858214d185a52094c66892b818abe695bc Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Tue, 20 Oct 2015 13:52:37 +0100 >Subject: [PATCH] Bug 14778: Install fixtures for t/Matcher.t > >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > t/Matcher.t | 38 ++++++++++++++++++-------------------- > 1 file changed, 18 insertions(+), 20 deletions(-) > >diff --git a/t/Matcher.t b/t/Matcher.t >index 484afe0..2a4246c 100755 >--- a/t/Matcher.t >+++ b/t/Matcher.t >@@ -4,30 +4,30 @@ > > use strict; > use warnings; >-use Test::More tests => 10; >+use Test::More tests => 11; > use Test::MockModule; > > BEGIN { > use_ok('C4::Matcher'); > } > >-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 $matcher = [ >- [ 'matcher_id', 'code', 'description', 'record_type', 'threshold' ], >- [ 1, 'ISBN', 'ISBN', 'red', 1 ], >- [ 2, 'ISSN', 'ISSN', 'blue', 0 ] >-]; >-my $dbh = C4::Context->dbh(); >- >-$dbh->{mock_add_resultset} = $matcher; >+use Test::DBIx::Class { >+ schema_class => 'Koha::Schema', >+ connect_info => ['dbi:SQLite:dbname=:memory:','',''], >+ connect_opts => { name_sep => '.', quote_char => '`', }, >+ fixture_class => '::Populate', >+}, 'MarcMatcher' ; >+ >+fixtures_ok [ >+ MarcMatcher => [ >+ [ 'matcher_id', 'code', 'description', 'record_type', 'threshold' ], >+ [ 1, 'ISBN', 'ISBN', 'red', 1 ], >+ [ 2, 'ISSN', 'ISSN', 'blue', 0 ] >+ ], >+], 'add fixtures'; >+ >+my $db = Test::MockModule->new('Koha::Database'); >+$db->mock( _new_schema => sub { return Schema(); } ); > > my @matchers = C4::Matcher::GetMatcherList(); > >@@ -35,8 +35,6 @@ is( $matchers[0]->{'matcher_id'}, 1, 'First matcher_id value is 1' ); > > is( $matchers[1]->{'matcher_id'}, 2, 'Second matcher_id value is 2' ); > >-$dbh->{mock_add_resultset} = $matcher; >- > my $matcher_id = C4::Matcher::GetMatcherId('ISBN'); > > is( $matcher_id, 1, 'testing getmatcherid' ); >-- >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 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