Skip to content

Commit

Permalink
more tests for buildHashRef
Browse files Browse the repository at this point in the history
  • Loading branch information
haarg committed Sep 17, 2009
1 parent 5499515 commit ab04037
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions t/SQL.t
Expand Up @@ -17,7 +17,7 @@ use WebGUI::Session;
use Data::Dumper;
use Test::Deep;

use Test::More tests => 53; # increment this value for each test you create
use Test::More tests => 56; # increment this value for each test you create

my $session = WebGUI::Test->session;

Expand Down Expand Up @@ -124,8 +124,17 @@ my %buildHash = $session->db->buildHash("select incrementerId,nextValue from inc
is($buildHash{theBigTest}, 25, "buildHash()");

# buildHashRef
my $buildHashRef = $session->db->buildHashRef("select incrementerId,nextValue from incrementer where incrementerId='theBigTest'");
is($buildHashRef->{theBigTest}, 25, "buildHashRef()");
my $buildHashRef = $session->db->buildHashRef("select incrementerId from incrementer where incrementerId='theBigTest'");
is_deeply($buildHashRef, {'theBigTest' => 'theBigTest'}, "buildHashRef() with 1 column");

$buildHashRef = $session->db->buildHashRef("select incrementerId,nextValue from incrementer where incrementerId='theBigTest'");
is_deeply($buildHashRef, {'theBigTest' => 25}, "buildHashRef() with 2 columns");

$buildHashRef = $session->db->buildHashRef("select incrementerId,incrementerId,nextValue from incrementer where incrementerId='theBigTest'");
is_deeply($buildHashRef, {'theBigTest:theBigTest' => 25}, "buildHashRef() with 3 columns");

$buildHashRef = $session->db->buildHashRef("select incrementerId,nextValue from incrementer where incrementerId='nonexistantIncrementer'");
is_deeply($buildHashRef, {}, "buildHashRef() with no results");

# getNextId
is($session->db->getNextId('theBigTest'), 25, "getNextId()");
Expand Down

0 comments on commit ab04037

Please sign in to comment.