More tests for bug fix #11009.
Abstract out making a session in WebGUI::Test. Update POD in Shop/Address. Add tests for newBySession, showing that the previous commit that allows update to update addressBookId actually fixed the bug in question.
This commit is contained in:
parent
f2e8d6a70b
commit
323edd888e
5 changed files with 79 additions and 42 deletions
|
|
@ -71,6 +71,36 @@ my $smtpdSelect;
|
|||
|
||||
my $mocker;
|
||||
|
||||
BEGIN {
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
=head2 sessionsToDelete ( $session, [$session, ...] )
|
||||
|
||||
Push a list of session objects onto the stack of groups to be automatically deleted
|
||||
at the end of the test. Note, this will be the last group of objects to be
|
||||
cleaned up.
|
||||
|
||||
This is a class method.
|
||||
|
||||
=cut
|
||||
|
||||
sub sessionsToDelete {
|
||||
my $class = shift;
|
||||
push @sessionsToDelete, @_;
|
||||
}
|
||||
|
||||
|
||||
sub newSession {
|
||||
my $pseudoRequest = WebGUI::PseudoRequest->new;
|
||||
my $session = WebGUI::Session->open( $WEBGUI_ROOT, $CONFIG_FILE );
|
||||
$session->{_request} = $pseudoRequest;
|
||||
WebGUI::Test->sessionsToDelete($session);
|
||||
return $session;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
BEGIN {
|
||||
|
||||
$mocker = Test::MockObject->fake_module(
|
||||
|
|
@ -162,10 +192,8 @@ BEGIN {
|
|||
exit(1);
|
||||
}
|
||||
|
||||
my $pseudoRequest = WebGUI::PseudoRequest->new;
|
||||
#$SESSION = WebGUI::Session->open( $WEBGUI_ROOT, $CONFIG_FILE, $pseudoRequest );
|
||||
$SESSION = WebGUI::Session->open( $WEBGUI_ROOT, $CONFIG_FILE );
|
||||
$SESSION->{_request} = $pseudoRequest;
|
||||
|
||||
$SESSION = WebGUI::Test->newSession;
|
||||
|
||||
$originalSetting = clone $SESSION->setting->get;
|
||||
}
|
||||
|
|
@ -193,10 +221,6 @@ END {
|
|||
$stor->delete;
|
||||
}
|
||||
}
|
||||
SESSION: foreach my $session (@sessionsToDelete) {
|
||||
$session->var->end;
|
||||
$session->close;
|
||||
}
|
||||
ASSET: foreach my $asset (@assetsToPurge) {
|
||||
$asset->purge;
|
||||
}
|
||||
|
|
@ -243,8 +267,10 @@ END {
|
|||
while (my ($param, $value) = each %{ $originalSetting }) {
|
||||
$SESSION->setting->set($param, $value);
|
||||
}
|
||||
$SESSION->var->end;
|
||||
$SESSION->close if defined $SESSION;
|
||||
SESSION: foreach my $session (@sessionsToDelete) {
|
||||
$session->var->end;
|
||||
$session->close;
|
||||
}
|
||||
|
||||
# Close SMTPD
|
||||
if ($smtpdPid) {
|
||||
|
|
@ -257,6 +283,12 @@ END {
|
|||
}
|
||||
}
|
||||
|
||||
=head2 newSession ( )
|
||||
|
||||
Builds a WebGUI session object for testing.
|
||||
|
||||
=cut
|
||||
|
||||
=head2 mockAssetId ( $assetId, $object )
|
||||
|
||||
Causes WebGUI::Asset->new* initializers to return the specified
|
||||
|
|
@ -716,23 +748,6 @@ sub storagesToDelete {
|
|||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
=head2 sessionsToDelete ( $session, [$session, ...] )
|
||||
|
||||
Push a list of session objects onto the stack of groups to be automatically deleted
|
||||
at the end of the test. Note, this will be the last group of objects to be
|
||||
cleaned up.
|
||||
|
||||
This is a class method.
|
||||
|
||||
=cut
|
||||
|
||||
sub sessionsToDelete {
|
||||
my $class = shift;
|
||||
push @sessionsToDelete, @_;
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
=head2 tagsToRollback ( $tag )
|
||||
|
||||
Push a list of version tags to rollback at the end of the test.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue