|
Lines 48-54
my $interface = C4::Context->interface;
Link Here
|
| 48 |
is( $interface, 'commandline', "Context interface set correctly with no flags" ); |
48 |
is( $interface, 'commandline', "Context interface set correctly with no flags" ); |
| 49 |
|
49 |
|
| 50 |
subtest 'lock_exec() tests' => sub { |
50 |
subtest 'lock_exec() tests' => sub { |
| 51 |
plan tests => 2; |
51 |
|
|
|
52 |
plan tests => 3; |
| 52 |
|
53 |
|
| 53 |
# Launch the sleep script |
54 |
# Launch the sleep script |
| 54 |
my $pid = fork(); |
55 |
my $pid = fork(); |
|
Lines 63-68
subtest 'lock_exec() tests' => sub {
Link Here
|
| 63 |
|
64 |
|
| 64 |
like( $result, qr{Unable to acquire the lock.*}, 'Exception found' ); |
65 |
like( $result, qr{Unable to acquire the lock.*}, 'Exception found' ); |
| 65 |
|
66 |
|
|
|
67 |
$pid = fork(); |
| 68 |
if ( $pid == 0 ) { |
| 69 |
system( dirname(__FILE__) . '/sleep.pl 2>&1' ); |
| 70 |
exit; |
| 71 |
} |
| 72 |
|
| 73 |
sleep 1; # Make sure we start after the fork |
| 74 |
$command = dirname(__FILE__) . '/wait.pl'; |
| 75 |
$result = `$command 2>&1`; |
| 76 |
|
| 77 |
is( $result, 'YAY!', 'wait.pl successfully waits for the lock' ); |
| 78 |
|
| 66 |
throws_ok |
79 |
throws_ok |
| 67 |
{ Koha::Script->new({ lock_name => 'blah' }); } |
80 |
{ Koha::Script->new({ lock_name => 'blah' }); } |
| 68 |
'Koha::Exceptions::MissingParameter', |
81 |
'Koha::Exceptions::MissingParameter', |