[LON-CAPA-cvs] cvs: modules /jerf/tests Utils.pm
bowersj2
lon-capa-cvs@mail.lon-capa.org
Fri, 11 Jul 2003 16:31:21 -0000
bowersj2 Fri Jul 11 12:31:21 2003 EDT
Modified files:
/modules/jerf/tests Utils.pm
Log:
Allow the testing to create and publish maps of the test data.
Index: modules/jerf/tests/Utils.pm
diff -u modules/jerf/tests/Utils.pm:1.10 modules/jerf/tests/Utils.pm:1.11
--- modules/jerf/tests/Utils.pm:1.10 Wed Jul 9 17:04:21 2003
+++ modules/jerf/tests/Utils.pm Fri Jul 11 12:31:21 2003
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# testing utilities
#
-# $Id: Utils.pm,v 1.10 2003/07/09 21:04:21 bowersj2 Exp $
+# $Id: Utils.pm,v 1.11 2003/07/11 16:31:21 bowersj2 Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -421,14 +421,26 @@
=item * I<copyResource>($source): Copies the given resource into the
"test" directory of the authoring space. The "source" is the name
of a file living in the "data" directory of this testing
- harness.
+ harness. This takes care of translating maps as needed.
=cut
+# FIXME: Error checking for files not existing, perms, etc.
sub copyResource {
my $self = shift;
my $source = shift;
- system ("cp data/$source " . $self->getResourceSpaceDir() . 'test/');
+
+ # Read the file in
+ my $file;
+ open $file, "<data/$source";
+ my $contents = join '', <$file>;
+ $contents =~ s/\(\*DOMAIN\*\)/$self->{domain}/g;
+ $contents =~ s/\(\*USER\*\)/$self->{name}/g;
+ $contents =~ s/\(\*DIR\*\)/test/g;
+
+ open $file, '>' . $self->getResourceSpaceDir() . "test/$source";
+ print $file $contents;
+ return;
}
=pod