From 2803ae520ccc9dc146c50286a9255f01a8b6156e Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Fri, 23 Feb 2007 22:27:23 +0000 Subject: [PATCH] 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. --- lib/WebGUI/User.pm | 4 ++-- t/User.t | 8 +++++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/WebGUI/User.pm b/lib/WebGUI/User.pm index 8a6cca3de..73a438d37 100644 --- a/lib/WebGUI/User.pm +++ b/lib/WebGUI/User.pm @@ -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); } diff --git a/t/User.t b/t/User.t index 6d3f8beba..3b780f3b4 100644 --- a/t/User.t +++ b/t/User.t @@ -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;