Bug 27597: Remove leading colon in ES query
[koha-ffzg.git] / t / Koha / Script.t
old mode 100644 (file)
new mode 100755 (executable)
index b585328..527ff24
@@ -39,7 +39,11 @@ is_deeply(
         'emailaddress'  => undef,
         'number'        => undef,
         'shibboleth'    => undef,
-        'branch'        => undef
+        'branch'        => undef,
+        'desk_id'       => undef,
+        'desk_name'     => undef,
+        'register_id'   => undef,
+        'register_name' => undef,
     },
     "Context userenv set correctly with no flags"
 );
@@ -48,7 +52,8 @@ my $interface = C4::Context->interface;
 is( $interface, 'commandline', "Context interface set correctly with no flags" );
 
 subtest 'lock_exec() tests' => sub {
-    plan tests => 2;
+
+    plan tests => 3;
 
     # Launch the sleep script
     my $pid = fork();
@@ -63,6 +68,18 @@ subtest 'lock_exec() tests' => sub {
 
     like( $result, qr{Unable to acquire the lock.*}, 'Exception found' );
 
+    $pid = fork();
+    if ( $pid == 0 ) {
+        system( dirname(__FILE__) . '/sleep.pl 2>&1' );
+        exit;
+    }
+
+    sleep 1; # Make sure we start after the fork
+    $command = dirname(__FILE__) . '/wait.pl';
+    $result  = `$command 2>&1`;
+
+    is( $result, 'YAY!', 'wait.pl successfully waits for the lock' );
+
     throws_ok
         { Koha::Script->new({ lock_name => 'blah' }); }
         'Koha::Exceptions::MissingParameter',