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 |
# newtestdoc(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 |
if ( @_ ) {
|
29 |
$self->{docstore}=shift;
|
30 |
}
|
31 |
$self->appl();
|
32 |
}
|
33 |
|
34 |
sub newtestdoc {
|
35 |
my $self=shift;
|
36 |
$self->{object}=$self->{appl}->activatedoc(@_);
|
37 |
$self->{inttest}{"new"}++;
|
38 |
}
|
39 |
|
40 |
sub docstore {
|
41 |
my $self=shift;
|
42 |
if ( ! defined $self->{docstore} ) {
|
43 |
$self->{storedir}=$self->temparea()."/DocTester/".$self->newfilename();
|
44 |
$self->{docstore}=ActiveDoc::ActiveConfig->new($self->{storedir});
|
45 |
}
|
46 |
return $self->{docstore};
|
47 |
}
|
48 |
|
49 |
sub appl {
|
50 |
my $self=shift;
|
51 |
if ( ! defined $self->{appl} ) {
|
52 |
my $doc=$self->docstore();
|
53 |
$self->{appl}=ActiveDoc::Application->new($doc);
|
54 |
|
55 |
}
|
56 |
return $self->{appl};
|
57 |
}
|
58 |
|
59 |
sub options {
|
60 |
my $self=shift;
|
61 |
$self->appl()->options(@_);
|
62 |
}
|
63 |
|
64 |
sub setoptions {
|
65 |
my $self=shift;
|
66 |
$self->appl()->setoptions(@_);
|
67 |
}
|
68 |
|
69 |
sub userinterface {
|
70 |
my $self=shift;
|
71 |
$self->{appl}->userinterface(@_);
|
72 |
}
|