[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
SF.net SVN: ledger-smb: [1322] trunk/t/11-ledgersmb.t
- Subject: SF.net SVN: ledger-smb: [1322] trunk/t/11-ledgersmb.t
- From: ..hidden..
- Date: Mon, 25 Jun 2007 21:57:05 -0700
Revision: 1322
http://svn.sourceforge.net/ledger-smb/?rev=1322&view=rev
Author: einhverfr
Date: 2007-06-25 21:57:04 -0700 (Mon, 25 Jun 2007)
Log Message:
-----------
Deleting arguments to LedgerSMB constructors
Modified Paths:
--------------
trunk/t/11-ledgersmb.t
Modified: trunk/t/11-ledgersmb.t
===================================================================
--- trunk/t/11-ledgersmb.t 2007-06-26 00:01:10 UTC (rev 1321)
+++ trunk/t/11-ledgersmb.t 2007-06-26 04:57:04 UTC (rev 1322)
@@ -34,7 +34,7 @@
##547 merge
-my $lsmb = LedgerSMB->new('script.pl?test=test&password=testing&login=admin');
+my $lsmb = LedgerSMB->new();
my %myconfig;
my $utfstr;
my @r;
@@ -43,7 +43,7 @@
isa_ok($lsmb, 'LedgerSMB');
# $lsmb->escape checks
-my $lsmb = LedgerSMB->new('script.pl?test=test&password=testing&login=admin');
+my $lsmb = LedgerSMB->new();
$utfstr = "\xd8\xad";
utf8::decode($utfstr);
ok(!$lsmb->escape, 'escape: (undef)');
@@ -61,7 +61,7 @@
}
# $lsmb->is_blank checks
-my $lsmb = LedgerSMB->new('script.pl?test=test&password=testing&login=admin');
+my $lsmb = LedgerSMB->new();
$lsmb->{blank} = ' ';
$lsmb->{notblank} = ' d ';
TODO: {
@@ -74,7 +74,7 @@
is($lsmb->is_blank('name' => 'blank'), 1, 'is_blank: blank');
# $lsmb->is_run_mode checks
-my $lsmb = LedgerSMB->new('script.pl?test=test&password=testing&login=admin');
+my $lsmb = LedgerSMB->new();
$ENV{GATEWAY_INTERFACE} = 'foo';
is($lsmb->is_run_mode('cgi'), 1, 'is_run_mode: CGI - CGI');
is($lsmb->is_run_mode('cli'), 0, 'is_run_mode: CGI - CLI');
@@ -101,7 +101,7 @@
is($lsmb->is_run_mode, 0, 'is_run_mode: CLI - (unknown mode)');
# $lsmb->num_text_rows checks
-my $lsmb = LedgerSMB->new('script.pl?test=test&password=testing&login=admin');
+my $lsmb = LedgerSMB->new();
is($lsmb->num_text_rows('string' => "apple\npear", 'cols' => 10, 'max' => 5),
2, 'num_text_rows: 2 rows, no column breakage, max 5 rows');
is($lsmb->num_text_rows('string' => "apple\npear", 'cols' => 10, 'max' => 1),
@@ -124,7 +124,7 @@
3, 'num_text_rows: 3 rows, word and non column breakage, no max row count');
# $lsmb->debug checks
-my $lsmb = LedgerSMB->new('script.pl?test=test&password=testing&login=admin');
+my $lsmb = LedgerSMB->new();
@r = trap{$lsmb->debug($lsmb)};
like($trap->stdout, qr|\n\$VAR1 = bless\( {[\n\s]+'action' => '',[\n\s]+'dbversion' => '\d+\.\d+\.\d+',[\n\s]+'path' => 'bin/mozilla',[\n\s]+'version' => '$lsmb->{version}'[\n\s]+}, 'LedgerSMB' \);|,
'debug: $lsmb, no file');
@@ -150,7 +150,7 @@
ok(!-e $lsmb->{file}, "debug: file creation failed");
# $lsmb->new checks
-my $lsmb = LedgerSMB->new('script.pl?test=test&password=testing&login=admin');
+my $lsmb = LedgerSMB->new();
ok(defined $lsmb, 'new: blank, defined');
isa_ok($lsmb, 'LedgerSMB', 'new: blank, correct type');
ok(defined $lsmb->{action}, 'new: blank, action defined');
@@ -158,7 +158,7 @@
ok(defined $lsmb->{path}, 'new: blank, path defined');
ok(defined $lsmb->{version}, 'new: blank, version defined');
-my $lsmb = LedgerSMB->new('script.pl?test=test&password=testing&login=admin&action=Apple%20sauce');
+my $lsmb = LedgerSMB->new();
ok(defined $lsmb, 'new: action set, defined');
isa_ok($lsmb, 'LedgerSMB', 'new: action set, correct type');
ok(defined $lsmb->{action}, 'new: action set, action defined');
@@ -167,7 +167,7 @@
ok(defined $lsmb->{path}, 'new: action set, path defined');
ok(defined $lsmb->{version}, 'new: action set, version defined');
-my $lsmb = LedgerSMB->new('script.pl?test=test&password=testing&login=admin&path=/bin/lynx');
+my $lsmb = LedgerSMB->new();
ok(defined $lsmb, 'new: lynx, defined');
isa_ok($lsmb, 'LedgerSMB', 'new: lynx, correct type');
ok(defined $lsmb->{action}, 'new: lynx, action defined');
@@ -180,18 +180,18 @@
is($lsmb->{menubar}, 1, 'new: lynx, menubar enabled (deprecated)');
ok(defined $lsmb->{version}, 'new: lynx, version defined');
..hidden.. = trap {$lsmb = LedgerSMB->new('script.pl?test=test&password=testing&login=admin&scrit=foo/bar.pl')};
..hidden.. = trap {$lsmb = LedgerSMB->new();
is($trap->die, "Error: Access Denied\n",
'new: directory traversal 1 caught');
..hidden.. = trap {$lsmb = LedgerSMB->new('script.pl?test=test&password=testing&login=admin&scrit=foo\\bar.pl')};
..hidden.. = trap {$lsmb = LedgerSMB->new();
is($trap->die, "Error: Access Denied\n",
'new: directory traversal 2 caught');
..hidden.. = trap {$lsmb = LedgerSMB->new('script.pl?test=test&password=testing&login=admin&scrit=..')};
..hidden.. = trap {$lsmb = LedgerSMB->new();
is($trap->die, "Error: Access Denied\n",
'new: directory traversal 3 caught');
# $lsmb->redirect checks
-my $lsmb = LedgerSMB->new('script.pl?test=test&password=testing&login=admin');
+my $lsmb = LedgerSMB->new();
ok(!defined $lsmb->{callback}, 'redirect: No callback set');
@r = trap{$lsmb->redirect};
is($trap->stdout, "redirected\n", 'redirect: No message or callback redirect');
@@ -208,7 +208,7 @@
is($trap->stdout, "redirected\n", 'redirect: callback and message redirect');
# $lsmb->call_procedure checks
-my $lsmb = LedgerSMB->new('script.pl?test=test&password=testing&login=admin');
+my $lsmb = LedgerSMB->new();
$lsmb->{dbh} = ${LedgerSMB::Sysconfig::GLOBALDBH};
@r = $lsmb->call_procedure('procname' => 'character_length',
'args' => ['month']);
@@ -244,21 +244,21 @@
##}
# $lsmb->merge checks
-my $lsmb = LedgerSMB->new('script.pl?test=test&password=testing&login=admin');
+my $lsmb = LedgerSMB->new();
$lsmb->merge({'apple' => 1, 'pear' => 2, 'peach' => 3}, 'keys' => ['apple', 'pear']);
ok(!defined $lsmb->{peach}, 'merge: Did not add unselected key');
is($lsmb->{apple}, 1, 'merge: Added unselected key apple');
is($lsmb->{pear}, 2, 'merge: Added unselected key pear');
like($lsmb->{path}, qr#bin/(lynx|mozilla)#, 'merge: left existing key');
-my $lsmb = LedgerSMB->new('script.pl?test=test&password=testing&login=admin');
+my $lsmb = LedgerSMB->new();
$lsmb->merge({'apple' => 1, 'pear' => 2, 'peach' => 3});
is($lsmb->{apple}, 1, 'merge: No key, added apple');
is($lsmb->{pear}, 2, 'merge: No key, added pear');
is($lsmb->{peach}, 3, 'merge: No key, added peach');
like($lsmb->{path}, qr#bin/(lynx|mozilla)#, 'merge: No key, left existing key');
-my $lsmb = LedgerSMB->new('script.pl?test=test&password=testing&login=admin');
+my $lsmb = LedgerSMB->new();
$lsmb->merge({'apple' => 1, 'pear' => 2, 'peach' => 3}, 'index' => 1);
is($lsmb->{apple_1}, 1, 'merge: Index 1, added apple as apple_1');
is($lsmb->{pear_1}, 2, 'merge: Index 1, added pear as pear_1');
@@ -266,7 +266,7 @@
like($lsmb->{path}, qr#bin/(lynx|mozilla)#, 'merge: Index 1, left existing key');
# $lsmb->is_allowed_role checks
-my $lsmb = LedgerSMB->new('script.pl?test=test&password=testing&login=admin');
+my $lsmb = LedgerSMB->new();
$lsmb->{_roles} = ('apple', 'pear');
is($lsmb->is_allowed_role('allowed_roles' => ['pear']), 1,
'is_allowed_role: allowed role');
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.