Bugzilla – Attachment 48394 Details for
Bug 4941
Remove singleBranchMode system preference
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 4941: Make tests non DB dependent
Bug-4941-Make-tests-non-DB-dependent.patch (text/plain), 4.19 KB, created by
Kyle M Hall (khall)
on 2016-02-26 12:25:02 UTC
(
hide
)
Description:
Bug 4941: Make tests non DB dependent
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2016-02-26 12:25:02 UTC
Size:
4.19 KB
patch
obsolete
>From 92c37ef4e2e711204a740d3af4e98db201feddbe Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Wed, 6 Jan 2016 10:41:21 +0000 >Subject: [PATCH] Bug 4941: Make tests non DB dependent > >Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz> > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >--- > t/Koha.t | 43 ++++++++++++++++++++++++++++++++++++++----- > t/db_dependent/Koha.t | 21 +-------------------- > 2 files changed, 39 insertions(+), 25 deletions(-) > >diff --git a/t/Koha.t b/t/Koha.t >index 366a21b..e887632 100755 >--- a/t/Koha.t >+++ b/t/Koha.t >@@ -25,7 +25,7 @@ use Module::Load::Conditional qw/check_install/; > > BEGIN { > if ( check_install( module => 'Test::DBIx::Class' ) ) { >- plan tests => 33; >+ plan tests => 34; > } else { > plan skip_all => "Need Test::DBIx::Class" > } >@@ -38,15 +38,19 @@ use Test::DBIx::Class { > connect_info => ['dbi:SQLite:dbname=:memory:','',''], > connect_opts => { name_sep => '.', quote_char => '`', }, > fixture_class => '::Populate', >-}, 'AuthorisedValue' ; >+}, 'AuthorisedValue', 'Branch' ; > > sub fixtures { >- my ( $data ) = @_; >+ my ( $av, $libraries ) = @_; > fixtures_ok [ > AuthorisedValue => [ > [ 'category', 'authorised_value' ], >- @$data, >+ @$av, > ], >+ Branch => [ >+ ['branchcode', 'branchname'], >+ @$libraries, >+ ] > ], 'add fixtures'; > } > >@@ -57,7 +61,10 @@ my $authorised_values = [ > ['LOC', 'LOC'], > ['RELTERMS', 'RELTERMS'], > ]; >-fixtures($authorised_values); >+my $libraries = [ >+ ['XXX_test', 'my branchname XXX'], >+]; >+fixtures($authorised_values, $libraries); > > is ( IsAuthorisedValueCategory('LOC'), 1, 'LOC is a valid authorized value category'); > is ( IsAuthorisedValueCategory('something'), 0, 'something is not a valid authorized value category'); >@@ -117,4 +124,30 @@ is( C4::Koha::GetNormalizedISBN(), undef, 'GetNormalizedISBN should return undef > is( C4::Koha::GetNormalizedEAN(), undef, 'GetNormalizedEAN should return undef if no record and no isbn are passed' ); > is( C4::Koha::GetNormalizedOCLCNumber(), undef, 'GetNormalizedOCLCNumber should return undef if no record and no isbn are passed' ); > >+subtest 'getFacets() tests' => sub { >+ plan tests => 5; >+ >+ is ( Koha::Libraries->search->count, 1, 'There should be only 1 library (singleBranchMode on)' ); >+ my $facets = C4::Koha::getFacets(); >+ is( >+ scalar( grep { defined $_->{idx} && $_->{idx} eq 'location' } @$facets ), >+ 1, >+ 'location facet present with singleBranchMode on (bug 10078)' >+ ); >+ >+ $libraries = [ >+ ['YYY_test', 'my branchname YYY'], >+ ['ZZZ_test', 'my branchname XXX'], >+ ]; >+ fixtures($authorised_values, $libraries); >+ is ( Koha::Libraries->search->count, 3, 'There should be only more than 1 library (singleBranchMode off)' ); >+ >+ $facets = C4::Koha::getFacets(); >+ is( >+ scalar( grep { defined $_->{idx} && $_->{idx} eq 'location' } @$facets ), >+ 1, >+ 'location facet present with singleBranchMode off (bug 10078)' >+ ); >+}; >+ > 1; >diff --git a/t/db_dependent/Koha.t b/t/db_dependent/Koha.t >index 6baae5c..74a2227 100644 >--- a/t/db_dependent/Koha.t >+++ b/t/db_dependent/Koha.t >@@ -8,7 +8,7 @@ use C4::Context; > use Koha::DateUtils qw(dt_from_string); > use Koha::AuthorisedValue; > >-use Test::More tests => 10; >+use Test::More tests => 9; > use DateTime::Format::MySQL; > > BEGIN { >@@ -258,25 +258,6 @@ subtest 'ISBN tests' => sub { > > }; > >-subtest 'getFacets() tests' => sub { >- plan tests => 2; >- >- C4::Context->set_preference('singleBranchMode', 0); >- my $facets = C4::Koha::getFacets(); >- is( >- scalar( grep { defined $_->{idx} && $_->{idx} eq 'location' } @$facets ), >- 1, >- 'location facet present with singleBranchMode off (bug 10078)' >- ); >- C4::Context->set_preference('singleBranchMode', 1); >- $facets = C4::Koha::getFacets(); >- is( >- scalar( grep { defined $_->{idx} && $_->{idx} eq 'location' } @$facets ), >- 1, >- 'location facet present with singleBranchMode on (bug 10078)' >- ); >-}; >- > subtest 'GetFrameworksLoop() tests' => sub { > plan tests => 6; > >-- >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 4941
:
46311
|
46312
|
46313
|
46755
|
46756
|
46757
|
47199
|
47200
|
47201
|
47202
|
48394
|
48395
|
48396
|
48397
|
48398