f9980f6b31
This patch adds a unit test for C4::Search in t/db_dependent. In order to test the functioning of the Zebra search, this patch actually includes an entire Zebra sandbox, and pre-indexed files, which are stored in t/db_dependent/data (the configuration files are generated on the fly). This test depends on Test::Warn, Test::MockModule, and DBD::Mock. To test: 1) Run the test. There should be no failures, and no warnings. Signed-off-by: Galen Charlton <gmc@esilibrary.com> Signed-off-by: wajasu <matted-34813@mypacks.net> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
41 lines
1.1 KiB
Perl
Executable file
41 lines
1.1 KiB
Perl
Executable file
#!/usr/bin/perl
|
|
|
|
use Modern::Perl;
|
|
use File::Copy;
|
|
use File::Path qw(make_path);
|
|
use File::Find;
|
|
use File::Basename;
|
|
use File::Spec;
|
|
|
|
my $source = File::Spec->rel2abs('.');
|
|
my $destination = File::Spec->rel2abs('.') . "/t/db_dependent/data";
|
|
|
|
make_path("$destination/var/lock/zebradb");
|
|
make_path("$destination/var/lib/zebradb");
|
|
make_path("$destination/var/run/zebradb");
|
|
|
|
$ENV{'INSTALL_BASE'} = $destination;
|
|
$ENV{'__INSTALL_BASE__'} = $destination;
|
|
|
|
my @files = ( "$source/etc/koha-conf.xml" );
|
|
|
|
find(sub { push @files, $File::Find::name if ( -f $File::Find::name ); }, "$source/etc/zebradb");
|
|
|
|
foreach my $file (@files) {
|
|
my $target = "$file";
|
|
$target =~ s#$source#$destination#;
|
|
$target =~ s#etc/zebradb#etc/koha/zebradb#;
|
|
unlink($target);
|
|
make_path(dirname($target));
|
|
copy("$file", "$target");
|
|
system("perl $source/rewrite-config.PL $target");
|
|
if ($file =~ m/xml/) {
|
|
replace("$target", "$destination/intranet/templates", "$source/koha-tmpl/intranet-tmpl");
|
|
}
|
|
}
|
|
|
|
|
|
sub replace {
|
|
my ($file, $pattern, $replacement) = @_;
|
|
system("sed -i -e 's#$pattern#$replacement#' $file");
|
|
}
|