Bug 20912: (QA follow-up) The default rule already has renewalsallowed=0
[koha.git] / t / XSLT.t
index 21c2e93..e3a7332 100755 (executable)
--- a/t/XSLT.t
+++ b/t/XSLT.t
 # 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/;
 
 use t::lib::Mocks;
 
+use Module::Load::Conditional qw/check_install/;
+
 BEGIN {
-    my $context_module = t::lib::Mocks::mock_dbh;
+    if ( check_install( module => 'Test::DBIx::Class' ) ) {
+        plan tests => 9;
+    } else {
+        plan skip_all => "Need Test::DBIx::Class"
+    }
+
     use_ok('C4::XSLT');
 };
 
+use Test::DBIx::Class;
+my $db = Test::MockModule->new('Koha::Database');
+$db->mock( _new_schema => sub { return Schema(); } );
+
 my $dir = File::Temp->newdir();
 my @themes = ('prog', 'test');
 my @langs = ('en', 'es-ES');
@@ -62,4 +73,7 @@ is(find_and_slurp($dir, 'test', 'fr-FR'), 'Theme test, language en',    'Fell ba
 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');
 
-1;
+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');
+