add user() sub to get a safe user for testing
This commit is contained in:
parent
9cb5c088b0
commit
580193596e
1 changed files with 18 additions and 0 deletions
|
|
@ -44,6 +44,7 @@ use Monkey::Patch qw( patch_object );
|
|||
use Scope::Guard;
|
||||
use WebGUI::Paths -inc;
|
||||
use namespace::clean;
|
||||
use WebGUI::User;
|
||||
|
||||
our @EXPORT = qw(cleanupGuard addToCleanup);
|
||||
our @EXPORT_OK = qw(session config collateral);
|
||||
|
|
@ -293,6 +294,23 @@ sub asset {
|
|||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
=head2 user ( props )
|
||||
|
||||
Create a safe user to use for testing. The user will be removed after the test
|
||||
is run.
|
||||
|
||||
=cut
|
||||
|
||||
sub user {
|
||||
my ( $class, %props ) = @_;
|
||||
my $user = WebGUI::User->create( $class->session );
|
||||
$user->update( %props );
|
||||
addToCleanup( $user );
|
||||
return $user;
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
=head2 config
|
||||
|
||||
Returns the config object from the session.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue