Ran coverage on User.t and found that we're missing two entire

methods, so I added TODO tests for them.  Overall coverage is low
as well.
Began converting User.pm to use placeholders.
This commit is contained in:
Colin Kuskie 2007-02-23 22:27:23 +00:00
parent 6efbad606f
commit 2803ae520c
2 changed files with 9 additions and 3 deletions

View file

@ -384,7 +384,7 @@ sub new {
unless ($userData->{_userId} && $userData->{_user}{username}) {
my %user;
tie %user, 'Tie::CPHash';
%user = $session->db->quickHash("select * from users where userId=".$session->db->quote($userId));
%user = $session->db->quickHash("select * from users where userId=?",[$userId]);
my %profile = $session->db->buildHash("select userProfileField.fieldName, userProfileData.fieldData
from userProfileField, userProfileData where userProfileField.fieldName=userProfileData.fieldName and
userProfileData.userId=".$session->db->quote($user{userId}));
@ -609,7 +609,7 @@ Returns true if the userId exists in the users table.
sub validUserId {
my ($class, $session, $userId) = @_;
my $sth = $session->db->read('select userId from users where userId='.$session->db->quote($userId));
my $sth = $session->db->read('select userId from users where userId=?',[$userId]);
return ($sth->rows == 1);
}

View file

@ -18,7 +18,7 @@ use WebGUI::Utility;
use WebGUI::Cache;
use WebGUI::User;
use Test::More tests => 82; # increment this value for each test you create
use Test::More tests => 84; # increment this value for each test you create
my $session = WebGUI::Test->session;
@ -301,6 +301,12 @@ WebGUI::Group->new($session, '7')->addUsers([1]);
ok($visitor->isInGroup(1), "Visitor added back to group Visitor");
ok($visitor->isInGroup(7), "Visitor added back to group Everyone");
TODO: {
local $TODO = "Untested methods";
ok(0, 'canUseAdminMode');
ok(0, 'newByEmail');
}
END {
(defined $user and ref $user eq 'WebGUI::User') and $user->delete;
$testCache->flush;