1 |
BEGIN
|
2 |
{
|
3 |
print " ActiveDoc::DocTester: I AM used!!","\n";
|
4 |
};
|
5 |
|
6 |
|
7 |
#
|
8 |
# DocTester.pm
|
9 |
#
|
10 |
# Originally Written by Christopher Williams
|
11 |
#
|
12 |
# Description
|
13 |
# -----------
|
14 |
# Extension of TestUtilities for doc testing
|
15 |
#
|
16 |
# Interface
|
17 |
# ---------
|
18 |
# new() : A new DocTester object
|
19 |
# initdoc([docstore]) : initialise starter doc etc.
|
20 |
# --- after initdoc can call
|
21 |
# newtestdoc(url) : create a new document with the given url
|
22 |
# docstore() : return the base document store
|
23 |
|
24 |
package ActiveDoc::DocTester;
|
25 |
require 5.004;
|
26 |
use ActiveDoc::Application;
|
27 |
use ActiveDoc::Query;
|
28 |
use Utilities::TestClass;
|
29 |
|
30 |
@ISA=qw(Utilities::TestClass);
|
31 |
|
32 |
sub initdoc {
|
33 |
my $self=shift;
|
34 |
if ( @_ ) {
|
35 |
$self->{docstore}=shift;
|
36 |
}
|
37 |
$self->appl();
|
38 |
}
|
39 |
|
40 |
sub newtestdoc {
|
41 |
my $self=shift;
|
42 |
$self->{object}=$self->{appl}->activatedoc(@_);
|
43 |
$self->{inttest}{"new"}++;
|
44 |
}
|
45 |
|
46 |
sub docstore {
|
47 |
my $self=shift;
|
48 |
if ( ! defined $self->{docstore} ) {
|
49 |
$self->{storedir}=$self->temparea()."/DocTester/".$self->newfilename();
|
50 |
$self->{docstore}=ActiveDoc::ActiveConfig->new($self->{storedir});
|
51 |
}
|
52 |
return $self->{docstore};
|
53 |
}
|
54 |
|
55 |
sub appl {
|
56 |
my $self=shift;
|
57 |
if ( ! defined $self->{appl} ) {
|
58 |
my $doc=$self->docstore();
|
59 |
$self->{appl}=ActiveDoc::Application->new($doc);
|
60 |
|
61 |
}
|
62 |
return $self->{appl};
|
63 |
}
|
64 |
|
65 |
sub options {
|
66 |
my $self=shift;
|
67 |
$self->appl()->options(@_);
|
68 |
}
|
69 |
|
70 |
sub setoption {
|
71 |
my $self=shift;
|
72 |
$self->appl()->setoption(@_);
|
73 |
}
|
74 |
|
75 |
sub userinterface {
|
76 |
my $self=shift;
|
77 |
$self->{appl}->userinterface(@_);
|
78 |
}
|