6 use Test::More tests => 25;
10 use_ok('MooseX::Daemonize::Pid::File');
14 my $f = MooseX::Daemonize::Pid::File->new(
15 file => [ 't', 'foo.pid' ]
17 isa_ok($f, 'MooseX::Daemonize::Pid::File');
19 isa_ok($f->file, 'Path::Class::File');
21 is($f->pid, $$, '... the PID is our current process');
25 } '... writing the PID file';
27 is($f->file->slurp(chomp => 1), $f->pid, '... the PID in the file is correct');
29 ok($f->is_running, '... it is running too');
33 } '... removing the PID file';
35 ok(!-e $f->file, '... the PID file does not exist anymore');
39 my $f = MooseX::Daemonize::Pid::File->new(
40 file => [ 't', 'bar.pid' ]
42 isa_ok($f, 'MooseX::Daemonize::Pid::File');
44 isa_ok($f->file, 'Path::Class::File');
48 } '... writing the PID file';
50 is($f->file->slurp(chomp => 1), $f->pid, '... the PID in the file is correct');
51 is($f->pid, $$, '... the PID is our current process');
53 ok($f->is_running, '... it is running too');
57 } '... removing the PID file';
59 ok(!-e $f->file, '... the PID file does not exist anymore');
65 my $f = MooseX::Daemonize::Pid::File->new(
66 file => [ 't', 'baz.pid' ],
69 isa_ok($f, 'MooseX::Daemonize::Pid::File');
71 isa_ok($f->file, 'Path::Class::File');
73 is($f->pid, $PID, '... the PID is our made up PID');
77 } '... writing the PID file';
79 is($f->file->slurp(chomp => 1), $f->pid, '... the PID in the file is correct');
81 ok(!$f->is_running, '... it is not running (cause we made the PID up)');
85 } '... removing the PID file';
87 ok(!-e $f->file, '... the PID file does not exist anymore');