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');
24 exception { $f->write },
26 '... writing the PID file',
29 is($f->file->slurp(chomp => 1), $f->pid, '... the PID in the file is correct');
31 ok($f->is_running, '... it is running too');
34 exception { $f->remove },
36 '... removing the PID file',
39 ok(!-e $f->file, '... the PID file does not exist anymore');
43 my $f = MooseX::Daemonize::Pid::File->new(
44 file => [ 't', 'bar.pid' ]
46 isa_ok($f, 'MooseX::Daemonize::Pid::File');
48 isa_ok($f->file, 'Path::Class::File');
51 exception { $f->write },
53 '... writing the PID file',
56 is($f->file->slurp(chomp => 1), $f->pid, '... the PID in the file is correct');
57 is($f->pid, $$, '... the PID is our current process');
59 ok($f->is_running, '... it is running too');
62 exception { $f->remove },
64 '... removing the PID file',
67 ok(!-e $f->file, '... the PID file does not exist anymore');
73 my $f = MooseX::Daemonize::Pid::File->new(
74 file => [ 't', 'baz.pid' ],
77 isa_ok($f, 'MooseX::Daemonize::Pid::File');
79 isa_ok($f->file, 'Path::Class::File');
81 is($f->pid, $PID, '... the PID is our made up PID');
84 exception { $f->write },
86 '... writing the PID file',
89 is($f->file->slurp(chomp => 1), $f->pid, '... the PID in the file is correct');
91 ok(!$f->is_running, '... it is not running (cause we made the PID up)');
94 exception { $f->remove },
96 '... removing the PID file',
99 ok(!-e $f->file, '... the PID file does not exist anymore');