Skip to content

Commit c776f54

Browse files
committed
chore: remove mark skipped
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
1 parent 9433d83 commit c776f54

2 files changed

Lines changed: 13 additions & 4 deletions

File tree

src/Sign/JSignService.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ public function getVersion(JSignParam $params)
7575
$jSignPdf = $params->getjSignPdfJarPath();
7676

7777
$command = "$java -jar $jSignPdf --version 2>&1";
78-
\exec($command, $output);
78+
exec($command, $output);
7979
$lastRow = end($output);
8080
if (empty($output) || strpos($lastRow, 'version') === false) {
8181
return '';

tests/JSignPDFTest.php

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ function exec(string $command, ?array &$output = null, ?int &$return_var = null)
1313

1414
namespace Jeidison\JSignPDF\Tests;
1515

16+
use org\bovigo\vfs\vfsStream;
1617
use Exception;
1718
use Jeidison\JSignPDF\Sign\JSignService;
1819
use Jeidison\JSignPDF\Tests\Builder\JSignParamBuilder;
@@ -194,10 +195,18 @@ public function testSignWhenJavaNotFound()
194195

195196
public function testGetVersion()
196197
{
197-
if (!class_exists('JSignPDF\JSignPDFBin\JavaCommandService')) {
198-
$this->markTestSkipped('Install jsignpdf/jsignpdf-bin');
199-
}
198+
global $mockExec;
199+
$mockExec = ['JSignPdf version 2.3.0'];
200+
200201
$params = JSignParamBuilder::instance()->withDefault();
202+
vfsStream::setup('download');
203+
mkdir('vfs://download/bin');
204+
touch('vfs://download/bin/java');
205+
chmod('vfs://download/bin/java', 0755);
206+
$params->setJavaPath('vfs://download/bin/java');
207+
$params->getJSignPdfDownloadUrl('fake_url');
208+
$params->setIsUseJavaInstalled(true);
209+
$params->setjSignPdfJarPath('faje_path');
201210
$version = $this->service->getVersion($params);
202211
$this->assertNotEmpty($version);
203212
}

0 commit comments

Comments
 (0)