diff options
author | einhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46> | 2007-06-26 04:57:04 +0000 |
---|---|---|
committer | einhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46> | 2007-06-26 04:57:04 +0000 |
commit | f239aa5207c4dfaafb6855a1a481730ae4ae61b7 (patch) | |
tree | 39dd13873ef59cc14810bea66b34f5290ce693e9 /t | |
parent | ad8fbf5c0f6bb3db77ca7e959a4aa476723285a1 (diff) |
Deleting arguments to LedgerSMB constructors
git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@1322 4979c152-3d1c-0410-bac9-87ea11338e46
Diffstat (limited to 't')
-rw-r--r-- | t/11-ledgersmb.t | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/t/11-ledgersmb.t b/t/11-ledgersmb.t index 66f82ab3..b1719ea9 100644 --- a/t/11-ledgersmb.t +++ b/t/11-ledgersmb.t @@ -34,7 +34,7 @@ sub lsmb_error_func { ##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 @@ ok(defined $lsmb); 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 @@ TODO: { } # $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' => 'notblank'), 0, 'is_blank: notblank'); 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('foo'), 0, 'is_run_mode: CLI - (bad mode)'); 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 @@ is($lsmb->num_text_rows('string' => "012345 67890123456789", 'cols' => 10), 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 @@ like($trap->die, qr/No such file or directory/, 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->{dbversion}, 'new: blank, dbversion defined'); 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->{dbversion}, 'new: action set, dbversion defined'); 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 @@ ok(defined $lsmb->{menubar}, 'new: lynx, menubar defined (deprecated)'); is($lsmb->{menubar}, 1, 'new: lynx, menubar enabled (deprecated)'); ok(defined $lsmb->{version}, 'new: lynx, version defined'); -@r = trap {$lsmb = LedgerSMB->new('script.pl?test=test&password=testing&login=admin&scrit=foo/bar.pl')}; +@r = trap {$lsmb = LedgerSMB->new(); is($trap->die, "Error: Access Denied\n", 'new: directory traversal 1 caught'); -@r = trap {$lsmb = LedgerSMB->new('script.pl?test=test&password=testing&login=admin&scrit=foo\\bar.pl')}; +@r = trap {$lsmb = LedgerSMB->new(); is($trap->die, "Error: Access Denied\n", 'new: directory traversal 2 caught'); -@r = trap {$lsmb = LedgerSMB->new('script.pl?test=test&password=testing&login=admin&scrit=..')}; +@r = 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, no message redirect'); 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 @@ is($r[1]->{'power'}, 4, 'call_procedure: ASC ordering'); ##} # $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 @@ is($lsmb->{peach_1}, 3, 'merge: Index 1, added peach as peach_1'); 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'); |