re-integrated photogallery branch
This commit is contained in:
commit
4c70aa4c71
75 changed files with 10806 additions and 473 deletions
|
|
@ -9,6 +9,7 @@ use Config qw[];
|
|||
use IO::Handle qw[];
|
||||
use File::Spec qw[];
|
||||
use Test::MockObject::Extends;
|
||||
use WebGUI::PseudoRequest;
|
||||
|
||||
##Hack to get ALL test output onto STDOUT.
|
||||
use Test::Builder;
|
||||
|
|
@ -115,6 +116,7 @@ sub config {
|
|||
return $SESSION->config;
|
||||
}
|
||||
|
||||
|
||||
sub file {
|
||||
return $CONFIG_FILE;
|
||||
}
|
||||
|
|
@ -136,7 +138,8 @@ of options with keys outlined below.
|
|||
=cut
|
||||
|
||||
sub getPage {
|
||||
my $session = shift; # The session object
|
||||
my $class = shift;
|
||||
my $session = $SESSION; # The session object
|
||||
my $asset = shift; # The asset object
|
||||
my $page = shift; # The page subroutine
|
||||
my $optionsRef = shift; # A hashref of options
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package WebGUI::Test::Maker::HTML;
|
|||
|
||||
use base 'WebGUI::Test::Maker';
|
||||
use Scalar::Util qw( blessed );
|
||||
use Carp qw( croak );
|
||||
use Test::More;
|
||||
|
||||
|
||||
|
|
@ -72,6 +73,8 @@ Create a new WebGUI::Test::Maker::HTML object.
|
|||
|
||||
Get a setting. Set L<set> for a list of settings.
|
||||
|
||||
=cut
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
=head2 plan
|
||||
|
|
@ -187,7 +190,7 @@ sub prepare {
|
|||
croak("Couldn't prepare: Test $test_num, test_regex is not an array reference")
|
||||
if $test->{test_regex} && ref $test->{test_regex} ne "ARRAY";
|
||||
croak("Couldn't prepare: Test $test_num, $test->{test_privilege} is not a valid test_privilege value (adminOnly, insufficient, noAccess, notMember, vitalComponent)")
|
||||
if $test->{test_privilege} && $test->{test_privilege} =~ m/adminOnly|insufficient|noAccess|notMember|vitalComponent/;
|
||||
if $test->{test_privilege} && $test->{test_privilege} !~ m/adminOnly|insufficient|noAccess|notMember|vitalComponent/;
|
||||
|
||||
push @{$self->{_tests}}, $test;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -55,9 +55,13 @@ Test::More
|
|||
|
||||
Create a new WebGUI::Test::Maker::Permission object.
|
||||
|
||||
=cut
|
||||
|
||||
=head2 get
|
||||
|
||||
Get a setting. Set L<set> for a list of settings.
|
||||
Get a setting. See C<set> for a list of settings.
|
||||
|
||||
=cut
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
|
|
@ -116,11 +120,13 @@ The permissions method to test
|
|||
|
||||
=item pass
|
||||
|
||||
An array reference of userIds that should pass the permissions test.
|
||||
An array reference of userIds or WebGUI::User objects that should pass the
|
||||
permissions test.
|
||||
|
||||
=item fail
|
||||
|
||||
An array reference of userIds that should fail the permissions test.
|
||||
An array reference of userIds or WebGUI::User objects that should fail the
|
||||
permissions test.
|
||||
|
||||
=back
|
||||
|
||||
|
|
@ -146,6 +152,16 @@ sub prepare {
|
|||
croak("Couldn't prepare: Test $test_num, fail is not an array reference")
|
||||
if $test->{fail} && ref $test->{fail} ne "ARRAY";
|
||||
|
||||
# Make sure pass and fail arrayrefs are userIds
|
||||
for my $array ( $test->{pass, fail} ) {
|
||||
for ( my $i = 0; $i < @$array; $i++ ) {
|
||||
# If is a User object, replace with userId
|
||||
if ( blessed $array->[$i] && $array->[$i]->isa("WebGUI::User") ) {
|
||||
$array->[$i] = $array->[$i]->userId;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
push @{$self->{_tests}}, $test;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue