Change cache strategy for User.t. Fix setRow in SQL.pm to accept overrides in row identifiers.
This commit is contained in:
parent
1c4ea8eacd
commit
7032e86cf1
3 changed files with 9 additions and 8 deletions
|
|
@ -962,9 +962,8 @@ Use this ID to create a new row. Same as setting the key value to "new" except t
|
|||
|
||||
sub setRow {
|
||||
my ($self, $table, $keyColumn, $data, $id) = @_;
|
||||
$data->{$keyColumn} ||= $id;
|
||||
if ($data->{$keyColumn} eq "new") {
|
||||
$data->{$keyColumn} = $self->session->id->generate();
|
||||
if ($data->{$keyColumn} eq "new" || $id) {
|
||||
$data->{$keyColumn} = $id || $self->session->id->generate();
|
||||
}
|
||||
my $dbh = $self->dbh;
|
||||
my @fields = ();
|
||||
|
|
|
|||
4
t/SQL.t
4
t/SQL.t
|
|
@ -17,7 +17,7 @@ use WebGUI::Session;
|
|||
use Data::Dumper;
|
||||
use Test::Deep;
|
||||
|
||||
use Test::More tests => 56; # increment this value for each test you create
|
||||
use Test::More tests => 57; # increment this value for each test you create
|
||||
|
||||
my $session = WebGUI::Test->session;
|
||||
|
||||
|
|
@ -145,6 +145,8 @@ my $setRowId = $session->db->setRow("incrementer","incrementerId",{incrementerId
|
|||
ok($setRowId ne "", "setRow() - return ID");
|
||||
my ($setRowResult) = $session->db->quickArray("select nextValue from incrementer where incrementerId=".$session->db->quote($setRowId));
|
||||
is($setRowResult, 47, "setRow() - set data");
|
||||
is $session->db->setRow("incrementer", "incrementerId",{incrementerId=>'new', nextValue => 48}, 'oogeyBoogeyBoo'),
|
||||
'oogeyBoogeyBoo', 'overriding default id with a custom one';
|
||||
|
||||
# getRow
|
||||
my $getRow = $session->db->getRow("incrementer","incrementerId",$setRowId);
|
||||
|
|
|
|||
8
t/User.t
8
t/User.t
|
|
@ -15,7 +15,6 @@ use lib "$FindBin::Bin/lib";
|
|||
use WebGUI::Test;
|
||||
use WebGUI::Session;
|
||||
use WebGUI::Utility;
|
||||
use WebGUI::Cache;
|
||||
#use Exception::Class;
|
||||
|
||||
use WebGUI::User;
|
||||
|
|
@ -28,8 +27,9 @@ use Data::Dumper;
|
|||
|
||||
my $session = WebGUI::Test->session;
|
||||
|
||||
my $testCache = WebGUI::Cache->new($session, 'myTestKey');
|
||||
$testCache->flush;
|
||||
#my $testCache = WebGUI::Cache->new($session, 'myTestKey');
|
||||
#$testCache->flush;
|
||||
$session->cache->remove('myTestKey');
|
||||
|
||||
my $user;
|
||||
my $lastUpdate;
|
||||
|
|
@ -1063,6 +1063,6 @@ END {
|
|||
|
||||
$newProfileField->delete() if $newProfileField;
|
||||
|
||||
$testCache->flush;
|
||||
$session->cache->delete('myTestKey');
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue