Bugzilla – Attachment 30679 Details for
Bug 12653
PROG/CCSR deprecation: Correct hard-coded opac-tmpl/prog path in tests
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 12653: PROG/CCSR deprecation: Correct hard-coded opac-tmpl/prog path in tests
Bug-12653-PROGCCSR-deprecation-Correct-hard-coded-.patch (text/plain), 8.50 KB, created by
Bernardo Gonzalez Kriegel
on 2014-08-11 06:29:34 UTC
(
hide
)
Description:
Bug 12653: PROG/CCSR deprecation: Correct hard-coded opac-tmpl/prog path in tests
Filename:
MIME Type:
Creator:
Bernardo Gonzalez Kriegel
Created:
2014-08-11 06:29:34 UTC
Size:
8.50 KB
patch
obsolete
>From 39b5f90fb48bcd39cffb0b902a69ca07b38eea9e Mon Sep 17 00:00:00 2001 >From: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> >Date: Mon, 11 Aug 2014 01:19:52 -0300 >Subject: [PATCH] Bug 12653: PROG/CCSR deprecation: Correct hard-coded > opac-tmpl/prog path in tests > >This patch removes explicit references of themes >from > xt/single_quotes.t > xt/author/valid-templates.t > xt/author/icondirectories.t > xt/author/translatable-templates.t > xt/tt_valid.t > >To test: >1. Apply the patch >2. Run each test, all must pass > >Some have been slightly rewritten, check >that intended or similar test is performed. >--- > xt/author/icondirectories.t | 71 +++++++++++++++++++------------------ > xt/author/translatable-templates.t | 5 +-- > xt/author/valid-templates.t | 72 ++++++++++++++++++++++++-------------- > xt/single_quotes.t | 25 ++++++++++--- > xt/tt_valid.t | 24 ++++++++++--- > 5 files changed, 126 insertions(+), 71 deletions(-) > >diff --git a/xt/author/icondirectories.t b/xt/author/icondirectories.t >index a4145fa..5d2ebf7 100644 >--- a/xt/author/icondirectories.t >+++ b/xt/author/icondirectories.t >@@ -20,44 +20,47 @@ use lib qw( .. ); > > use Data::Dumper; > use File::Find; >-use Test::More tests => 3; >- >-my $opac_icon_directory = 'koha-tmpl/opac-tmpl/prog/itemtypeimg'; >-my $staff_icon_directory = 'koha-tmpl/intranet-tmpl/prog/img/itemtypeimg'; >- >-ok( -d $opac_icon_directory, "opac_icon_directory: $opac_icon_directory exists" ); >-ok( -d $staff_icon_directory, "staff_icon_directory: $staff_icon_directory exists" ); >- >-my $opac_icons; # hashref of filenames to sizes >-sub opac_wanted { >- my $file = $File::Find::name; >- $file =~ s/^$opac_icon_directory//; >- $opac_icons->{ $file } = -s $_; >+use C4::Context; >+ >+use Test::More tests => 8; >+ >+my @themes; >+my $dh; >+# OPAC >+my $htdocs = C4::Context->config('opachtdocs'); >+opendir ($dh, $htdocs); >+for my $theme ( grep { not /^\.|lib/ } readdir($dh) ) { >+ push @themes, { >+ theme => $theme, >+ icondir => "$htdocs/$theme/itemtypeimg", >+ }; > } >- >-find( \&opac_wanted, $opac_icon_directory ); >- >-my $staff_icons; # hashref of filenames to sizes >-sub staff_wanted { >- my $file = $File::Find::name; >- $file =~ s/^$staff_icon_directory//; >- $staff_icons->{ $file } = -s $_; >+close $dh; >+# Intranet >+$htdocs = C4::Context->config('intrahtdocs'); >+opendir ($dh, $htdocs); >+for my $theme ( grep { not /^\.|lib|js/ } readdir($dh) ) { >+ push @themes, { >+ theme => $theme, >+ icondir => "$htdocs/$theme/img/itemtypeimg", >+ }; > } >-find( \&staff_wanted, $staff_icon_directory ); >- >-is_deeply( $opac_icons, $staff_icons, "staff and OPAC icon directories have same contents" ) >- or diag( Data::Dumper->Dump( [ $opac_icons ], [ 'opac_icons' ] ) ); >- >- >- >- >- >- >- >- >- >+close $dh; > >+my $icons; >+foreach my $theme ( @themes ) { >+ ok( -d $theme->{'icondir'}, "$theme->{'theme'}: directory exists"); > >+ $icons = undef; >+ my $where = $theme->{'icondir' }; >+ sub wanted { >+ my $file = $_; >+ $icons->{ $file } = -s $_; >+ } > >+ find( \&wanted, $where ); > >+ ok ( defined $icons, "Some contents in $where dir") >+ or diag( Data::Dumper->Dump( [ $icons ], [ 'icons' ] ) ); >+} > >diff --git a/xt/author/translatable-templates.t b/xt/author/translatable-templates.t >index 8079cd6..9f2e365 100644 >--- a/xt/author/translatable-templates.t >+++ b/xt/author/translatable-templates.t >@@ -12,6 +12,7 @@ construct that the extractor cannot parse. > > =cut > >+use C4::Context; > use Test::More tests => 2; > use File::Temp qw/tempdir/; > use IPC::Open3; >@@ -22,8 +23,8 @@ use utf8; > my $po_dir = tempdir(CLEANUP => 1); > > chdir "misc/translator"; # for now, tmpl_process3.pl works only if run from its directory >-test_string_extraction("opac", "../../koha-tmpl/opac-tmpl/prog/en", $po_dir); >-test_string_extraction("intranet", "../../koha-tmpl/intranet-tmpl/prog/en", $po_dir); >+test_string_extraction("opac", "../../koha-tmpl/opac-tmpl/". C4::Context->preference('opacthemes')."/en", $po_dir); >+test_string_extraction("intranet", "../../koha-tmpl/intranet-tmpl/".C4::Context->preference('template' )."/en", $po_dir); > > sub test_string_extraction { > my $module = shift; >diff --git a/xt/author/valid-templates.t b/xt/author/valid-templates.t >index e02b6f3..957864f 100644 >--- a/xt/author/valid-templates.t >+++ b/xt/author/valid-templates.t >@@ -35,32 +35,52 @@ use File::Find; > use File::Spec; > use Template; > use Test::More; >-# use FindBin; >-# use IPC::Open3; >- >-print "Testing intranet prog templates\n"; >-run_template_test( >- 'koha-tmpl/intranet-tmpl/prog/en/modules', >- 'koha-tmpl/intranet-tmpl/prog/en/includes' >-); >- >-print "Testing opac bootstrap templates\n"; >-run_template_test( >- 'koha-tmpl/opac-tmpl/bootstrap/en/modules', >- 'koha-tmpl/opac-tmpl/bootstrap/en/includes', >- # templates to exclude from testing because >- # they cannot stand alone >- 'doc-head-close.inc', >- 'opac-bottom.inc', >-); >- >-print "Testing opac prog templates\n"; >-run_template_test( >- 'koha-tmpl/opac-tmpl/prog/en/modules', >- 'koha-tmpl/opac-tmpl/prog/en/includes' >-); >- >-# TODO add test of opac ccsr templates >+use C4::Context; >+ >+my @themes; >+my $dh; >+# OPAC >+my $htdocs = C4::Context->config('opachtdocs'); >+opendir ($dh, $htdocs); >+for my $theme ( grep { not /^\.|lib/ } readdir($dh) ) { >+ push @themes, { >+ theme => $theme, >+ modules => "$htdocs/$theme/en/modules", >+ includes => "$htdocs/$theme/en/includes", >+ } >+} >+close $dh; >+# Intranet >+$htdocs = C4::Context->config('intrahtdocs'); >+opendir ($dh, $htdocs); >+for my $theme ( grep { not /^\.|lib|js/ } readdir($dh) ) { >+ push @themes, { >+ theme => $theme, >+ modules => "$htdocs/$theme/en/modules", >+ includes => "$htdocs/$theme/en/includes", >+ } >+} >+close $dh; >+ >+foreach my $theme ( @themes ) { >+ print "Testing $theme->{'theme'} templates\n"; >+ if ( $theme->{'theme'} eq 'bootstrap' ) { >+ run_template_test( >+ $theme->{'modules'}, >+ $theme->{'includes'}, >+ # templates to exclude from testing because >+ # they cannot stand alone >+ 'doc-head-close.inc', >+ 'opac-bottom.inc', >+ ); >+ } >+ else{ >+ run_template_test( >+ $theme->{'modules'}, >+ $theme->{'includes'}, >+ ); >+ } >+} > > done_testing(); > >diff --git a/xt/single_quotes.t b/xt/single_quotes.t >index 89b539c..4dc5808 100755 >--- a/xt/single_quotes.t >+++ b/xt/single_quotes.t >@@ -21,6 +21,24 @@ use warnings; > use strict; > use Test::More tests => 1; > use File::Find; >+use C4::Context; >+ >+my @themes; >+my $dh; >+# OPAC >+my $htdocs = C4::Context->config('opachtdocs'); >+opendir ($dh, $htdocs); >+for my $theme ( grep { not /^\.|lib/ } readdir($dh) ) { >+ push @themes, "$htdocs/$theme"; >+} >+close $dh; >+# Intranet >+$htdocs = C4::Context->config('intrahtdocs'); >+opendir ($dh, $htdocs); >+for my $theme ( grep { not /^\.|lib|js/ } readdir($dh) ) { >+ push @themes, "$htdocs/$theme"; >+} >+close $dh; > > my @files; > find( >@@ -28,11 +46,8 @@ find( > open my $fh, $_ or die "Could not open $_: $!"; > my @lines = sort grep /\_\(\'/, <$fh>; > push @files, { name => "$_", lines => \@lines } if @lines; >- },qw# >- ./koha-tmpl/opac-tmpl/prog/en >- ./koha-tmpl/opac-tmpl/bootstrap/en >- ./koha-tmpl/intranet-tmpl/prog/en >- # >+ }, >+ @themes > ); > > ok( !@files, "Files do not contain single quotes _(' " ) >diff --git a/xt/tt_valid.t b/xt/tt_valid.t >index e33b760..9b556f1 100755 >--- a/xt/tt_valid.t >+++ b/xt/tt_valid.t >@@ -23,7 +23,24 @@ use Test::More tests => 2; > use File::Find; > use Cwd; > use C4::TTParser; >- >+use C4::Context; >+ >+my @themes; >+my $dh; >+# OPAC >+my $htdocs = C4::Context->config('opachtdocs'); >+opendir ($dh, $htdocs); >+for my $theme ( grep { not /^\.|lib/ } readdir($dh) ) { >+ push @themes, "$htdocs/$theme"; >+} >+close $dh; >+# Intranet >+$htdocs = C4::Context->config('intrahtdocs'); >+opendir ($dh, $htdocs); >+for my $theme ( grep { not /^\.|lib|js/ } readdir($dh) ) { >+ push @themes, "$htdocs/$theme"; >+} >+close $dh; > > my @files_with_directive_in_tag = do { > my @files; >@@ -42,13 +59,12 @@ my @files_with_directive_in_tag = do { > } > ($dir) = $dir =~ /koha-tmpl\/(.*)$/; > push @files, { name => "$dir/$name", lines => \@lines } if @lines; >- }, ( "./koha-tmpl/opac-tmpl/prog/en", >- "./koha-tmpl/intranet-tmpl/prog/en" ) >+ }, >+ @themes, > ); > @files; > }; > >- > ok( !@files_with_directive_in_tag, "TT syntax: not using TT directive within HTML tag" ) > or diag( > "Files list: \n", >-- >1.9.1
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 12653
:
30679
|
30706
|
32477
|
32528
|
32529
|
32537
|
32540
|
32541
|
32542
|
32561
|
32743
|
32744
|
32745
|
32953
|
32959