File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -91,6 +91,7 @@ private function commandSign(JSignParam $params)
9191 if (!$ jSignPdf && class_exists ('JSignPDF\JSignPDFBin\JSignPdfPathService ' )) {
9292 $ jSignPdf = \JSignPDF \JSignPDFBin \JSignPdfPathService::jSignPdfJarPath ();
9393 }
94+ $ this ->throwIf (!file_exists ($ jSignPdf ), 'Jar of JSignPDF not found on path: ' . $ jSignPdf );
9495
9596 return "$ java -jar $ jSignPdf $ pdf -ksf $ certificate -ksp ' {$ params ->getPassword ()}' {$ params ->getJSignParameters ()} -d {$ params ->getPathPdfSigned ()}" ;
9697 }
Original file line number Diff line number Diff line change @@ -82,6 +82,13 @@ public function testSignWhenPasswordIsInvalid()
8282 $ this ->service ->sign ($ params );
8383 }
8484
85+ public function testSignWhenJarNotFound ()
86+ {
87+ $ this ->expectExceptionMessageMatches ('/Jar of JSignPDF not found on path/ ' );
88+ $ params = JSignParamBuilder::instance ()->withDefault ()->setIsUseJavaInstalled (true );
89+ $ this ->service ->sign ($ params );
90+ }
91+
8592 public function testSignWhenJavaNotFound ()
8693 {
8794 $ javaVersion = exec ("java -version 2>&1 " );
You can’t perform that action at this time.
0 commit comments