Bugzilla – Attachment 62299 Details for
Bug 18445
Tests in t stumble over Auth's BEGIN block
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 18445: Remove Test::DBIx::Class from XSLT.t
Bug-18445-Remove-TestDBIxClass-from-XSLTt.patch (text/plain), 3.22 KB, created by
Marcel de Rooy
on 2017-04-18 14:57:43 UTC
(
hide
)
Description:
Bug 18445: Remove Test::DBIx::Class from XSLT.t
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2017-04-18 14:57:43 UTC
Size:
3.22 KB
patch
obsolete
>From f04a8569145406633295639ae0245fcc255eaa8e Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Tue, 18 Apr 2017 16:29:28 +0200 >Subject: [PATCH] Bug 18445: Remove Test::DBIx::Class from XSLT.t >Content-Type: text/plain; charset=utf-8 > >Removing the tests around get_xslt_sysprefs from XSLT.t. >It makes no sense to test sysprefs values in a test that should be >database agnostic. > >Will add t/db_dependent/XSLT.t to rescue the ideas behind these lines. > >Test plan: >Run t/XSLT.t >Run t/db_dependent/XSLT.t > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >--- > t/XSLT.t | 31 ++----------------------------- > t/db_dependent/XSLT.t | 23 +++++++++++++++++++++++ > 2 files changed, 25 insertions(+), 29 deletions(-) > create mode 100644 t/db_dependent/XSLT.t > >diff --git a/t/XSLT.t b/t/XSLT.t >index 7136375..1b8d085 100755 >--- a/t/XSLT.t >+++ b/t/XSLT.t >@@ -16,7 +16,7 @@ > # along with Koha; if not, see <http://www.gnu.org/licenses>. > > use Modern::Perl; >-use Test::More; >+use Test::More tests => 8; > > use File::Temp; > use File::Path qw/make_path/; >@@ -25,28 +25,7 @@ use t::lib::Mocks; > > use Module::Load::Conditional qw/check_install/; > >-BEGIN { >- if ( check_install( module => 'Test::DBIx::Class' ) ) { >- plan tests => 10; >- } else { >- plan skip_all => "Need Test::DBIx::Class" >- } >- >- use_ok('C4::XSLT'); >-}; >- >-use Test::DBIx::Class { >- schema_class => 'Koha::Schema', >- connect_info => ['dbi:SQLite:dbname=:memory:','',''], >- connect_opts => { name_sep => '.', quote_char => '`', }, >- fixture_class => '::Populate', >-}, 'Branch' ; >- >-fixtures_ok [ >- Branch => [ >- ], >-]; >- >+use_ok('C4::XSLT'); > > my $dir = File::Temp->newdir(); > my @themes = ('prog', 'test'); >@@ -81,9 +60,3 @@ is(find_and_slurp($dir, 'prog', 'es-ES'), 'Theme prog, language es-ES', 'Found t > is(find_and_slurp($dir, 'test', 'fr-FR'), 'Theme test, language en', 'Fell back to test/en for test/fr-FR'); > is(find_and_slurp($dir, 'nope', 'es-ES'), 'Theme prog, language es-ES', 'Fell back to prog/es-ES for nope/es-ES'); > is(find_and_slurp($dir, 'nope', 'fr-FR'), 'Theme prog, language en', 'Fell back to prog/en for nope/fr-FR'); >- >-my $matching_string = q{<syspref name="singleBranchMode">0</syspref>}; >-my $sysprefs_xml = C4::XSLT::get_xslt_sysprefs(); >-ok( $sysprefs_xml =~ m/$matching_string/, 'singleBranchMode has a value of 0'); >- >-1; >diff --git a/t/db_dependent/XSLT.t b/t/db_dependent/XSLT.t >new file mode 100644 >index 0000000..2ce0420 >--- /dev/null >+++ b/t/db_dependent/XSLT.t >@@ -0,0 +1,23 @@ >+use Modern::Perl; >+use Test::More tests => 2; >+ >+use t::lib::Mocks; >+ >+use C4::XSLT; >+use Koha::Database; >+use Koha::Libraries; >+ >+my $schema = Koha::Database->new->schema; >+$schema->storage->txn_begin; >+ >+# Test get_xslt_sysprefs >+t::lib::Mocks::mock_preference( 'opacthemes', 'SomeThemeUnknown' ); >+my $cnt = Koha::Libraries->count; >+my $matching_string = q{<syspref name="singleBranchMode">0</syspref>}; >+$matching_string =~ s/0/1/ if $cnt==1; >+my $sysprefs_xml = C4::XSLT::get_xslt_sysprefs; >+ok( $sysprefs_xml =~ m/$matching_string/, 'Check singleBranchMode'); >+ok( $sysprefs_xml =~ m/<syspref name="opacthemes">SomeThemeUnknown<\/syspref>/, >+ 'mocked preference found' ); >+ >+$schema->storage->txn_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 18445
:
62290
|
62292
|
62293
| 62299