moved some things into sub folders
This commit is contained in:
parent
cbaacde6ba
commit
4ecdd5022b
7 changed files with 15 additions and 18 deletions
65
t/Session/DateTime.t
Normal file
65
t/Session/DateTime.t
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
#-------------------------------------------------------------------
|
||||
# WebGUI is Copyright 2001-2006 Plain Black Corporation.
|
||||
#-------------------------------------------------------------------
|
||||
# Please read the legal notices (docs/legal.txt) and the license
|
||||
# (docs/license.txt) that came with this distribution before using
|
||||
# this software.
|
||||
#-------------------------------------------------------------------
|
||||
# http://www.plainblack.com info@plainblack.com
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
# ---- BEGIN DO NOT EDIT ----
|
||||
use strict;
|
||||
use lib '../../lib';
|
||||
use Getopt::Long;
|
||||
use WebGUI::Session;
|
||||
# ---- END DO NOT EDIT ----
|
||||
use Test::More tests => 22; # increment this value for each test you create
|
||||
|
||||
my $session = initialize(); # this line is required
|
||||
|
||||
my $wgbday = 997966800;
|
||||
ok($session->datetime->addToDate($wgbday,1,2,3) >= $wgbday+1*60*60*24*365+2*60*60*24*28+3*60*60*24, "addToDate()");
|
||||
ok($session->datetime->addToTime($wgbday,1,2,3) >= $wgbday+1*60*60+2*60+3, "addToTime()");
|
||||
my ($start, $end) = $session->datetime->dayStartEnd($wgbday);
|
||||
ok($end-$start >= 60*60*23, "dayStartEnd()");
|
||||
is($session->datetime->epochToHuman($wgbday,"%%%c%d%h"), "%August1608", "epochToHuman()");
|
||||
is($session->datetime->epochToSet($wgbday,1), "2001-08-16 08:00:00", "epochToSet()");
|
||||
is($session->datetime->getDayName(7), "Sunday", "getDayName()");
|
||||
is($session->datetime->getDaysInMonth($wgbday), 31, "getDaysInMonth()");
|
||||
is($session->datetime->getDaysInInterval($wgbday,$wgbday+3*60*60*24), 3, "getDaysInInterval()");
|
||||
is($session->datetime->getFirstDayInMonthPosition($wgbday), 3, "getFirstDayInMonthPosition()");
|
||||
is($session->datetime->getMonthName(1), "January", "getMonthName()");
|
||||
is($session->datetime->getSecondsFromEpoch($wgbday), 60*60*8, "getSecondsFromEpoch()");
|
||||
SKIP: {
|
||||
skip("getTimeZones() - not sure how to test",1);
|
||||
ok($session->datetime->getTimeZones(),"getTimeZones()");
|
||||
}
|
||||
is($session->datetime->humanToEpoch("2001-08-16 08:00:00"), $wgbday, "humanToEpoch()");
|
||||
is($session->datetime->intervalToSeconds(2,"weeks"),60*60*24*14, "intervalToSeconds()");
|
||||
is(join("-",$session->datetime->localtime($wgbday)),'2001-8-16-8-0-0-228-4-1', "localtime()");
|
||||
is($session->datetime->monthCount($wgbday,$wgbday+60*60*24*365), 12, "monthCount()");
|
||||
my ($start, $end) = $session->datetime->monthStartEnd($wgbday);
|
||||
ok($end-$start >= 60*60*24*28, "monthStartEnd()");
|
||||
is(join(" ",$session->datetime->secondsToInterval(60*60*24*365*2)),"2 years", "secondsToInterval()");
|
||||
is($session->datetime->secondsToTime(60*60*8),"08:00:00", "secondsToTime()");
|
||||
is($session->datetime->setToEpoch("2001-08-16 08:00:00"), $wgbday, "setToEpoch()");
|
||||
ok($session->datetime->time() > $wgbday,"time()");
|
||||
is($session->datetime->timeToSeconds("08:00:00"), 60*60*8, "timeToSeconds()");
|
||||
|
||||
cleanup($session); # this line is required
|
||||
|
||||
# ---- DO NOT EDIT BELOW THIS LINE -----
|
||||
sub initialize {
|
||||
$|=1; # disable output buffering
|
||||
my $configFile;
|
||||
GetOptions(
|
||||
'configFile=s'=>\$configFile
|
||||
);
|
||||
exit 1 unless ($configFile);
|
||||
my $session = WebGUI::Session->open("../..",$configFile);
|
||||
}
|
||||
sub cleanup {
|
||||
my $session = shift;
|
||||
$session->close();
|
||||
}
|
||||
44
t/Session/Env.t
Normal file
44
t/Session/Env.t
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
#-------------------------------------------------------------------
|
||||
# WebGUI is Copyright 2001-2006 Plain Black Corporation.
|
||||
#-------------------------------------------------------------------
|
||||
# Please read the legal notices (docs/legal.txt) and the license
|
||||
# (docs/license.txt) that came with this distribution before using
|
||||
# this software.
|
||||
#-------------------------------------------------------------------
|
||||
# http://www.plainblack.com info@plainblack.com
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
# ---- BEGIN DO NOT EDIT ----
|
||||
use strict;
|
||||
use lib '../../lib';
|
||||
use Getopt::Long;
|
||||
use WebGUI::Session;
|
||||
# ---- END DO NOT EDIT ----
|
||||
|
||||
|
||||
use Test::More tests => 1; # increment this value for each test you create
|
||||
|
||||
my $session = initialize(); # this line is required
|
||||
|
||||
ok($session->env->get("PATH") ne "", "get()");
|
||||
|
||||
cleanup($session); # this line is required
|
||||
|
||||
|
||||
# ---- DO NOT EDIT BELOW THIS LINE -----
|
||||
|
||||
sub initialize {
|
||||
$|=1; # disable output buffering
|
||||
my $configFile;
|
||||
GetOptions(
|
||||
'configFile=s'=>\$configFile
|
||||
);
|
||||
exit 1 unless ($configFile);
|
||||
my $session = WebGUI::Session->open("../..",$configFile);
|
||||
}
|
||||
|
||||
sub cleanup {
|
||||
my $session = shift;
|
||||
$session->close();
|
||||
}
|
||||
|
||||
56
t/Session/Id.t
Normal file
56
t/Session/Id.t
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
#-------------------------------------------------------------------
|
||||
# WebGUI is Copyright 2001-2006 Plain Black Corporation.
|
||||
#-------------------------------------------------------------------
|
||||
# Please read the legal notices (docs/legal.txt) and the license
|
||||
# (docs/license.txt) that came with this distribution before using
|
||||
# this software.
|
||||
#-------------------------------------------------------------------
|
||||
# http://www.plainblack.com info@plainblack.com
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
# ---- BEGIN DO NOT EDIT ----
|
||||
use strict;
|
||||
use lib '../../lib';
|
||||
use Getopt::Long;
|
||||
use WebGUI::Session;
|
||||
# ---- END DO NOT EDIT ----
|
||||
|
||||
|
||||
use Test::More tests => 2; # increment this value for each test you create
|
||||
use WebGUI::Utility;
|
||||
|
||||
my $session = initialize(); # this line is required
|
||||
|
||||
# generate
|
||||
my $generateId = $session->id->generate();
|
||||
is(length($generateId), 22, "generate() - length of 22 characters");
|
||||
my @uniqueIds;
|
||||
my $isUnique = 1;
|
||||
for (1..2000) {
|
||||
last unless $isUnique;
|
||||
my $id = $session->id->generate();
|
||||
$isUnique = !isIn($id,@uniqueIds);
|
||||
push(@uniqueIds,$id);
|
||||
}
|
||||
ok($isUnique, "generate() - unique");
|
||||
|
||||
cleanup($session); # this line is required
|
||||
|
||||
|
||||
# ---- DO NOT EDIT BELOW THIS LINE -----
|
||||
|
||||
sub initialize {
|
||||
$|=1; # disable output buffering
|
||||
my $configFile;
|
||||
GetOptions(
|
||||
'configFile=s'=>\$configFile
|
||||
);
|
||||
exit 1 unless ($configFile);
|
||||
my $session = WebGUI::Session->open("../..",$configFile);
|
||||
}
|
||||
|
||||
sub cleanup {
|
||||
my $session = shift;
|
||||
$session->close();
|
||||
}
|
||||
|
||||
45
t/Session/Os.t
Normal file
45
t/Session/Os.t
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
#-------------------------------------------------------------------
|
||||
# WebGUI is Copyright 2001-2006 Plain Black Corporation.
|
||||
#-------------------------------------------------------------------
|
||||
# Please read the legal notices (docs/legal.txt) and the license
|
||||
# (docs/license.txt) that came with this distribution before using
|
||||
# this software.
|
||||
#-------------------------------------------------------------------
|
||||
# http://www.plainblack.com info@plainblack.com
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
# ---- BEGIN DO NOT EDIT ----
|
||||
use strict;
|
||||
use lib '../../lib';
|
||||
use Getopt::Long;
|
||||
use WebGUI::Session;
|
||||
# ---- END DO NOT EDIT ----
|
||||
|
||||
|
||||
use Test::More tests => 2; # increment this value for each test you create
|
||||
|
||||
my $session = initialize(); # this line is required
|
||||
|
||||
ok($session->os->get("name") ne "", "get(name)");
|
||||
ok($session->os->get("type") eq "Windowsish" || $session->os->get("type") eq "Linuxish", "get(type)");
|
||||
|
||||
cleanup($session); # this line is required
|
||||
|
||||
|
||||
# ---- DO NOT EDIT BELOW THIS LINE -----
|
||||
|
||||
sub initialize {
|
||||
$|=1; # disable output buffering
|
||||
my $configFile;
|
||||
GetOptions(
|
||||
'configFile=s'=>\$configFile
|
||||
);
|
||||
exit 1 unless ($configFile);
|
||||
my $session = WebGUI::Session->open("../..",$configFile);
|
||||
}
|
||||
|
||||
sub cleanup {
|
||||
my $session = shift;
|
||||
$session->close();
|
||||
}
|
||||
|
||||
47
t/Session/Setting.t
Normal file
47
t/Session/Setting.t
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
#-------------------------------------------------------------------
|
||||
# WebGUI is Copyright 2001-2006 Plain Black Corporation.
|
||||
#-------------------------------------------------------------------
|
||||
# Please read the legal notices (docs/legal.txt) and the license
|
||||
# (docs/license.txt) that came with this distribution before using
|
||||
# this software.
|
||||
#-------------------------------------------------------------------
|
||||
# http://www.plainblack.com info@plainblack.com
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
# ---- BEGIN DO NOT EDIT ----
|
||||
use strict;
|
||||
use lib '../../lib';
|
||||
use Getopt::Long;
|
||||
use WebGUI::Session;
|
||||
# ---- END DO NOT EDIT ----
|
||||
use Test::More tests => 4; # increment this value for each test you create
|
||||
|
||||
my $session = initialize(); # this line is required
|
||||
|
||||
$session->setting->add("test","XXX");
|
||||
my ($value) = $session->db->quickArray("select value from settings where name='test'");
|
||||
is($value, 'XXX', "add()");
|
||||
is($session->setting->get("test"), "XXX", "get()");
|
||||
$session->setting->set("test","YYY");
|
||||
my ($value) = $session->db->quickArray("select value from settings where name='test'");
|
||||
is($value, 'YYY', "set()");
|
||||
$session->setting->remove("test");
|
||||
my ($value) = $session->db->quickArray("select value from settings where name='test'");
|
||||
is($value, undef, "delete()");
|
||||
|
||||
cleanup($session); # this line is required
|
||||
|
||||
# ---- DO NOT EDIT BELOW THIS LINE -----
|
||||
sub initialize {
|
||||
$|=1; # disable output buffering
|
||||
my $configFile;
|
||||
GetOptions(
|
||||
'configFile=s'=>\$configFile
|
||||
);
|
||||
exit 1 unless ($configFile);
|
||||
my $session = WebGUI::Session->open("../..",$configFile);
|
||||
}
|
||||
sub cleanup {
|
||||
my $session = shift;
|
||||
$session->close();
|
||||
}
|
||||
55
t/Session/Stow.t
Normal file
55
t/Session/Stow.t
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
#-------------------------------------------------------------------
|
||||
# WebGUI is Copyright 2001-2006 Plain Black Corporation.
|
||||
#-------------------------------------------------------------------
|
||||
# Please read the legal notices (docs/legal.txt) and the license
|
||||
# (docs/license.txt) that came with this distribution before using
|
||||
# this software.
|
||||
#-------------------------------------------------------------------
|
||||
# http://www.plainblack.com info@plainblack.com
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
# ---- BEGIN DO NOT EDIT ----
|
||||
use strict;
|
||||
use lib '../../lib';
|
||||
use Getopt::Long;
|
||||
use WebGUI::Session;
|
||||
# ---- END DO NOT EDIT ----
|
||||
use Test::More tests => 22; # increment this value for each test you create
|
||||
|
||||
my $session = initialize(); # this line is required
|
||||
|
||||
# put your tests here
|
||||
|
||||
my $stow = $session->stow;
|
||||
my $count = 0;
|
||||
my $maxCount = 20;
|
||||
|
||||
for (my $count = 1; $count <= $maxCount; $count++){
|
||||
$stow->set("Test$count",$count);
|
||||
}
|
||||
|
||||
for (my $count = 1; $count <= $maxCount; $count++){
|
||||
is($stow->get("Test$count"), $count, "Passed set/get $count\n");
|
||||
}
|
||||
|
||||
$stow->delete("Test1");
|
||||
is($stow->get("Test1"), undef, "delete()");
|
||||
$stow->deleteAll;
|
||||
is($stow->get("Test2"), undef, "deleteAll()");
|
||||
|
||||
cleanup($session); # this line is required
|
||||
|
||||
# ---- DO NOT EDIT BELOW THIS LINE -----
|
||||
sub initialize {
|
||||
$|=1; # disable output buffering
|
||||
my $configFile;
|
||||
GetOptions(
|
||||
'configFile=s'=>\$configFile
|
||||
);
|
||||
exit 1 unless ($configFile);
|
||||
my $session = WebGUI::Session->open("../..",$configFile);
|
||||
}
|
||||
sub cleanup {
|
||||
my $session = shift;
|
||||
$session->close();
|
||||
}
|
||||
50
t/Session/Var.t
Normal file
50
t/Session/Var.t
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
#-------------------------------------------------------------------
|
||||
# WebGUI is Copyright 2001-2006 Plain Black Corporation.
|
||||
#-------------------------------------------------------------------
|
||||
# Please read the legal notices (docs/legal.txt) and the license
|
||||
# (docs/license.txt) that came with this distribution before using
|
||||
# this software.
|
||||
#-------------------------------------------------------------------
|
||||
# http://www.plainblack.com info@plainblack.com
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
# ---- BEGIN DO NOT EDIT ----
|
||||
use strict;
|
||||
use lib '../../lib';
|
||||
use Getopt::Long;
|
||||
use WebGUI::Session;
|
||||
# ---- END DO NOT EDIT ----
|
||||
use Test::More tests => 6; # increment this value for each test you create
|
||||
|
||||
my $session = initialize(); # this line is required
|
||||
|
||||
|
||||
ok($session->var->getId ne "", "getId()");
|
||||
ok($session->var->get("lastPageView") > 0, "get()");
|
||||
is($session->var->isAdminOn, 0, "isAdminOn()");
|
||||
$session->var->switchAdminOn;
|
||||
is($session->var->isAdminOn, 1, "switchAdminOn()");
|
||||
$session->var->switchAdminOff;
|
||||
is($session->var->isAdminOn, 0, "switchAdminOff()");
|
||||
my $id = $session->var->getId;
|
||||
$session->var->end;
|
||||
my ($count) = $session->db->quickArray("select count(*) from userSession where sessionId=".$session->db->quote($id));
|
||||
ok($count == 0,"end()");
|
||||
|
||||
|
||||
cleanup($session); # this line is required
|
||||
|
||||
# ---- DO NOT EDIT BELOW THIS LINE -----
|
||||
sub initialize {
|
||||
$|=1; # disable output buffering
|
||||
my $configFile;
|
||||
GetOptions(
|
||||
'configFile=s'=>\$configFile
|
||||
);
|
||||
exit 1 unless ($configFile);
|
||||
my $session = WebGUI::Session->open("../..",$configFile);
|
||||
}
|
||||
sub cleanup {
|
||||
my $session = shift;
|
||||
$session->close();
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue