1 |
#
|
2 |
# DocTester.pm
|
3 |
#
|
4 |
# Originally Written by Christopher Williams
|
5 |
#
|
6 |
# Description
|
7 |
# -----------
|
8 |
# Extension of TestUtilities for doc testing
|
9 |
#
|
10 |
# Interface
|
11 |
# ---------
|
12 |
# new() : A new DocTester object
|
13 |
# initdoc([docstore]) : initialise starter doc etc.
|
14 |
# --- after initdoc can call
|
15 |
# newdoc(url) : create a new document with the given url
|
16 |
# docstore() : return the base document store
|
17 |
|
18 |
package ActiveDoc::DocTester;
|
19 |
require 5.004;
|
20 |
use ActiveDoc::Application;
|
21 |
use ActiveDoc::Query;
|
22 |
use Utilities::TestClass;
|
23 |
|
24 |
@ISA=qw(Utilities::TestClass);
|
25 |
|
26 |
sub initdoc {
|
27 |
my $self=shift;
|
28 |
# make a new tmp store
|
29 |
if ( @_ ) {
|
30 |
$self->{docstore}=shift;
|
31 |
}
|
32 |
else {
|
33 |
$self->{storedir}=$self->temparea()."/DocTester";
|
34 |
$self->{docstore}=ActiveDoc::ActiveConfig->new($self->{storedir});
|
35 |
}
|
36 |
$self->{appl}=ActiveDoc::Application->new($self->{docstore});
|
37 |
$self->{appl}->options(ActiveDoc::Query->new());
|
38 |
}
|
39 |
|
40 |
sub newdoc {
|
41 |
my $self=shift;
|
42 |
$self->{object}=$self->{appl}->activatedoc(@_);
|
43 |
}
|
44 |
|
45 |
sub options {
|
46 |
my $self=shift;
|
47 |
$self->{appl}->options(@_);
|
48 |
}
|
49 |
|
50 |
sub userinterface {
|
51 |
my $self=shift;
|
52 |
$self->{appl}->userinterface(@_);
|
53 |
}
|
54 |
|
55 |
sub docstore {
|
56 |
my $self=shift;
|
57 |
$self->{docstore};
|
58 |
}
|