Apache-SWIT
view release on metacpan or search on metacpan
t/500_swit_init.t view on Meta::CPAN
use strict;
use warnings FATAL => 'all';
use Test::More tests => 67;
use File::Temp qw(tempdir);
use Data::Dumper;
use File::Path qw(rmtree);
use Test::TempDatabase;
use Apache::SWIT::Test::ModuleTester;
use Apache::SWIT::Test::Utils;
use File::Slurp;
BEGIN { use_ok('Apache::SWIT::Maker'); }
delete $ENV{TEST_FILES};
delete $ENV{MAKEFLAGS};
delete $ENV{MAKEOVERRIDES};
my $mt = Apache::SWIT::Test::ModuleTester->new({ root_class => 'TTT' });
chdir $mt->root_dir;
$mt->make_swit_project;
ok(-f 'LICENSE');
my $swit_str = read_file('conf/swit.yaml');
like($swit_str, qr/TTT/);
like($swit_str, qr/\/ttt/);
like($swit_str, qr/TTT::Session/);
ok(-f "conf/httpd.conf.in");
ok(-f "lib/TTT/Session.pm");
`./scripts/swit_app.pl add_test t/dual/newdir/987_test.t`;
ok(-f 't/dual/newdir/987_test.t');
$mt->replace_in_file('t/dual/001_load.t', '=> 11', '=> 12');
append_file('t/dual/001_load.t', <<'ENDM');
use Apache::SWIT::Test::Utils;
$t->with_or_without_mech_do(1, sub {
unlike(ASTU_Read_Error_Log(), qr/\[debug\]/);
});
ENDM
sub check_db_is_clean {
my @files = glob("/tmp/db_is_clean.ttt_test_db*.$<");
my $res;
if ($<) {
$res = ok(scalar(@files));
unlink($_) for @files;
} else {
$res = ok(!scalar(@files));
}
$res or ASTU_Wait;
}
check_db_is_clean();
my @tmp_contents = glob('/tmp/*');
`perl Makefile.PL`;
my $tres = join('', `make test 2>&1`);
like($tres, qr/All tests successful/) or ASTU_Wait;
like($tres, qr/t\/dual\/001_load/);
like($tres, qr/started\n.*dual/) or ASTU_Wait($mt->root_dir);
like($tres, qr/Files=2/);
unlike($tres, qr/Error/) or ASTU_Wait;
unlike($tres, qr/Please use/);
like($tres, qr/987_test/);
ok(-d 't/logs');
( run in 2.272 seconds using v1.01-cache-2.11-cpan-437f7b0c052 )