Bug 22706: (RM follow-up) Add unit tests
authorMartin Renvoize <martin.renvoize@ptfs-europe.com>
Thu, 31 Oct 2019 11:22:09 +0000 (11:22 +0000)
committerMartin Renvoize <martin.renvoize@ptfs-europe.com>
Thu, 31 Oct 2019 11:23:26 +0000 (11:23 +0000)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
t/lib/Koha/Plugin/Test.pm

index e34b61d..7a963d9 100644 (file)
@@ -213,6 +213,21 @@ sub api_routes {
     return decode_json($spec);
 }
 
+sub check_password {
+    my ( $self, $args ) = @_;
+
+    my $password = $args->{'password'};
+    if ( $password && $password =~ m/^\d\d\d\d$/ ) {
+        return { error => 0 };
+    }
+    else {
+        return {
+            error => 1,
+            msg   => "PIN should be four digits"
+        };
+    }
+}
+
 sub _private_sub {
     return "";
 }