lemonldap-ng/lemonldap-ng-portal/t/test-lib.pm

54 lines
1.1 KiB
Perl
Raw Normal View History

2016-04-03 18:27:13 +02:00
# Base library for portal tests
use strict;
use Data::Dumper;
use 5.10.0;
use_ok('Lemonldap::NG::Common::PSGI::Cli::Lib');
use_ok('Lemonldap::NG::Portal::Main');
our $client;
our $count = 3;
$Data::Dumper::Deparse = 1;
ok(
$client = Lemonldap::NG::Common::PSGI::Cli::Lib->new(
{
app => Lemonldap::NG::Portal::Main->run(
{
configStorage => { type => 'File', dirName => 't' },
2016-04-03 18:27:22 +02:00
logLevel => 'debug',
2016-04-03 18:27:13 +02:00
cookieName => 'lemonldap',
securedCookie => 0,
https => 0,
}
),
}
),
'Portal app'
);
sub client {
return $client;
}
sub count {
my $c = shift;
$count += $c if ($c);
return $count;
}
sub explain {
my ( $get, $ref ) = @_;
$get = Dumper($get) if ( ref $get );
print STDERR "Expect $ref, get $get\n";
}
2016-04-04 22:39:22 +02:00
sub clean_sessions {
opendir D, 't/sessions' or die $!;
foreach ( grep { /^[^\.]/ } readdir(D) ) {
unlink "t/sessions/$_", "t/sessions/lock/Apache-Session-$_.lock";
}
}
2016-04-03 18:27:13 +02:00
1;