mirror of
https://github.com/LibreSign/libresign.git
synced 2025-12-18 05:20:45 +01:00
Rename project to libresign
This commit is contained in:
parent
e5de58a76f
commit
76db66a543
29 changed files with 105 additions and 105 deletions
|
|
@ -3,4 +3,4 @@
|
|||
if (false === (@include_once __DIR__.'/../vendor/autoload.php')) {
|
||||
throw new Exception('Cannot include autoload. Did you run install dependencies using composer?');
|
||||
}
|
||||
$app = \OC::$server->query(OCA\Signer\AppInfo\Application::class);
|
||||
$app = \OC::$server->query(OCA\Libresign\AppInfo\Application::class);
|
||||
|
|
|
|||
|
|
@ -1,23 +1,23 @@
|
|||
<?xml version="1.0"?>
|
||||
<info xmlns:xsi= "http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://apps.nextcloud.com/schema/apps/info.xsd">
|
||||
<id>signer</id>
|
||||
<name>Signer</name>
|
||||
<id>libresign</id>
|
||||
<name>libresign</name>
|
||||
<summary>App for signing documents.</summary>
|
||||
<description><![CDATA[This is a app for signing documents]]></description>
|
||||
<version>1.0.1</version>
|
||||
<licence>agpl</licence>
|
||||
<namespace>Signer</namespace>
|
||||
<namespace>Libresign</namespace>
|
||||
<dependencies>
|
||||
<nextcloud min-version="17" max-version="20"/>
|
||||
</dependencies>
|
||||
<navigations>
|
||||
<navigation>
|
||||
<name>Signer</name>
|
||||
<route>signer.page.index</route>
|
||||
<name>Libresign</name>
|
||||
<route>libresign.page.index</route>
|
||||
</navigation>
|
||||
</navigations>
|
||||
<settings>
|
||||
<admin>OCA\Signer\Settings\AdminSettings</admin>
|
||||
<admin>OCA\Libresign\Settings\AdminSettings</admin>
|
||||
</settings>
|
||||
|
||||
</info>
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ return [
|
|||
'routes' => [
|
||||
['name' => 'api#preflighted_cors', 'url' => '/api/0.1/{path}',
|
||||
'verb' => 'OPTIONS', 'requirements' => ['path' => '.+'], ],
|
||||
['name' => 'signer#sign', 'url' => '/api/0.1/sign', 'verb' => 'POST'],
|
||||
['name' => 'libresign#sign', 'url' => '/api/0.1/sign', 'verb' => 'POST'],
|
||||
['name' => 'signature#generate', 'url' => '/api/0.1/signature/generate', 'verb' => 'POST'],
|
||||
['name' => 'signature#check', 'url' => '/api/0.1/signature/check', 'verb' => 'GET'],
|
||||
['name' => 'admin#generateCertificate', 'url' => '/api/0.1/admin/certificate', 'verb' => 'POST'],
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "lt/signer",
|
||||
"description": "Signer",
|
||||
"name": "lyseontech/libresign",
|
||||
"description": "libresign",
|
||||
"type": "project",
|
||||
"license": "AGPL",
|
||||
"require": {
|
||||
|
|
@ -18,7 +18,7 @@
|
|||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"OCA\\Signer\\": "lib/"
|
||||
"OCA\\Libresign\\": "lib/"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,16 +1,16 @@
|
|||
<?php
|
||||
|
||||
namespace OCA\Signer\AppInfo;
|
||||
namespace OCA\Libresign\AppInfo;
|
||||
|
||||
use OCA\Files\Event\LoadSidebar;
|
||||
use OCA\Signer\Listener\LoadSidebarListener;
|
||||
use OCA\Signer\Storage\ClientStorage;
|
||||
use OCA\Libresign\Listener\LoadSidebarListener;
|
||||
use OCA\Libresign\Storage\ClientStorage;
|
||||
use OCP\AppFramework\App;
|
||||
use OCP\EventDispatcher\IEventDispatcher;
|
||||
|
||||
class Application extends App
|
||||
{
|
||||
public const APP_ID = 'signer';
|
||||
public const APP_ID = 'libresign';
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
<?php
|
||||
|
||||
namespace OCA\Signer\Controller;
|
||||
namespace OCA\Libresign\Controller;
|
||||
|
||||
use OCA\Signer\AppInfo\Application;
|
||||
use OCA\Signer\Service\AdminSignatureService;
|
||||
use OCA\Libresign\AppInfo\Application;
|
||||
use OCA\Libresign\Service\AdminSignatureService;
|
||||
use OCP\AppFramework\Controller;
|
||||
use OCP\AppFramework\Http\DataResponse;
|
||||
use OCP\IRequest;
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
|
||||
namespace OCA\Signer\Controller;
|
||||
namespace OCA\Libresign\Controller;
|
||||
|
||||
use OCA\Signer\Exception\SignerException;
|
||||
use OCA\Libresign\Exception\LibresignException;
|
||||
use OCP\AppFramework\Http;
|
||||
use OCP\AppFramework\Http\DataResponse;
|
||||
|
||||
|
|
@ -10,7 +10,7 @@ trait HandleErrorsTrait
|
|||
{
|
||||
protected function handleErrors(\Exception $exception): DataResponse
|
||||
{
|
||||
if ($exception instanceof SignerException) {
|
||||
if ($exception instanceof LibresignException) {
|
||||
return new DataResponse($exception->jsonSerialize(), $exception->getCode());
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
|
||||
namespace OCA\Signer\Controller;
|
||||
namespace OCA\Libresign\Controller;
|
||||
|
||||
use OCA\Signer\Exception\SignerException;
|
||||
use OCA\Libresign\Exception\LibresignException;
|
||||
|
||||
trait HandleParamsTrait
|
||||
{
|
||||
|
|
@ -10,7 +10,7 @@ trait HandleParamsTrait
|
|||
{
|
||||
foreach ($params as $key => $param) {
|
||||
if (empty($param)) {
|
||||
throw new SignerException("parameter '{$key}' is required!", 400);
|
||||
throw new LibresignException("parameter '{$key}' is required!", 400);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
<?php
|
||||
|
||||
namespace OCA\Signer\Controller;
|
||||
namespace OCA\Libresign\Controller;
|
||||
|
||||
use OC\Config;
|
||||
use OCA\Signer\AppInfo\Application;
|
||||
use OCA\Libresign\AppInfo\Application;
|
||||
use OCP\AppFramework\Controller;
|
||||
use OCP\AppFramework\Http\ContentSecurityPolicy;
|
||||
use OCP\AppFramework\Http\EmptyContentSecurityPolicy;
|
||||
|
|
@ -30,7 +30,7 @@ class PageController extends Controller
|
|||
*/
|
||||
public function index()
|
||||
{
|
||||
Util::addScript(Application::APP_ID, 'signer-main');
|
||||
Util::addScript(Application::APP_ID, 'libresign-main');
|
||||
|
||||
$response = new TemplateResponse(Application::APP_ID, 'main');
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
<?php
|
||||
|
||||
namespace OCA\Signer\Controller;
|
||||
namespace OCA\Libresign\Controller;
|
||||
|
||||
use OCA\Signer\AppInfo\Application;
|
||||
use OCA\Signer\Service\SignatureService;
|
||||
use OCA\Libresign\AppInfo\Application;
|
||||
use OCA\Libresign\Service\SignatureService;
|
||||
use OCP\AppFramework\Controller;
|
||||
use OCP\AppFramework\Http\DataResponse;
|
||||
use OCP\IRequest;
|
||||
|
|
|
|||
|
|
@ -1,20 +1,20 @@
|
|||
<?php
|
||||
|
||||
namespace OCA\Signer\Controller;
|
||||
namespace OCA\Libresign\Controller;
|
||||
|
||||
use OCA\Signer\AppInfo\Application;
|
||||
use OCA\Signer\Exception\SignerException;
|
||||
use OCA\Signer\Service\SignerService;
|
||||
use OCA\Libresign\AppInfo\Application;
|
||||
use OCA\Libresign\Exception\LibresignException;
|
||||
use OCA\Libresign\Service\LibresignService;
|
||||
use OCP\AppFramework\Controller;
|
||||
use OCP\AppFramework\Http\DataResponse;
|
||||
use OCP\IRequest;
|
||||
|
||||
class SignerController extends Controller
|
||||
class LibresignController extends Controller
|
||||
{
|
||||
use HandleErrorsTrait;
|
||||
use HandleParamsTrait;
|
||||
|
||||
/** @var SignerService */
|
||||
/** @var LibresignService */
|
||||
private $service;
|
||||
|
||||
/** @var string */
|
||||
|
|
@ -22,7 +22,7 @@ class SignerController extends Controller
|
|||
|
||||
public function __construct(
|
||||
IRequest $request,
|
||||
SignerService $service,
|
||||
LibresignService $service,
|
||||
$userId
|
||||
) {
|
||||
parent::__construct(Application::APP_ID, $request);
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
<?php
|
||||
|
||||
namespace OCA\Signer\Exception;
|
||||
namespace OCA\Libresign\Exception;
|
||||
|
||||
use JsonSerializable;
|
||||
|
||||
class SignerException extends \Exception implements JsonSerializable
|
||||
class LibresignException extends \Exception implements JsonSerializable
|
||||
{
|
||||
public function jsonSerialize()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
<?php
|
||||
|
||||
namespace OCA\Signer\Handler;
|
||||
namespace OCA\Libresign\Handler;
|
||||
|
||||
use GuzzleHttp\Client;
|
||||
use OCA\Signer\Exception\SignerException;
|
||||
use OCA\Libresign\Exception\LibresignException;
|
||||
|
||||
class CfsslHandler
|
||||
{
|
||||
|
|
@ -25,7 +25,7 @@ class CfsslHandler
|
|||
$certContent = null;
|
||||
$isCertGenerated = openssl_pkcs12_export($certKeys['certificate'], $certContent, $certKeys['private_key'], $password);
|
||||
if (!$isCertGenerated) {
|
||||
throw new SignerException('Error while creating certificate file', 500);
|
||||
throw new LibresignException('Error while creating certificate file', 500);
|
||||
}
|
||||
|
||||
return $certContent;
|
||||
|
|
@ -65,7 +65,7 @@ class CfsslHandler
|
|||
|
||||
$responseDecoded = json_decode($response->getBody(), true);
|
||||
if (!$responseDecoded['success']) {
|
||||
throw new SignerException('Error while generating certificate keys!', 500);
|
||||
throw new LibresignException('Error while generating certificate keys!', 500);
|
||||
}
|
||||
|
||||
return $responseDecoded['result'];
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
|
||||
namespace OCA\Signer\Handler;
|
||||
namespace OCA\Libresign\Handler;
|
||||
|
||||
use OCA\Signer\Exception\SignerException;
|
||||
use OCA\Libresign\Exception\LibresignException;
|
||||
|
||||
class CfsslServerHandler
|
||||
{
|
||||
|
|
@ -52,7 +52,7 @@ class CfsslServerHandler
|
|||
|
||||
$response = file_put_contents($filename, json_encode($content));
|
||||
if ($response === false) {
|
||||
throw new SignerException("Error while writing CSR server file!", 500);
|
||||
throw new LibresignException("Error while writing CSR server file!", 500);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -83,7 +83,7 @@ class CfsslServerHandler
|
|||
|
||||
$response = file_put_contents($filename, json_encode($content));
|
||||
if ($response === false) {
|
||||
throw new SignerException("Error while writing config server file!", 500);
|
||||
throw new LibresignException("Error while writing config server file!", 500);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,13 +1,13 @@
|
|||
<?php
|
||||
|
||||
namespace OCA\Signer\Handler;
|
||||
namespace OCA\Libresign\Handler;
|
||||
|
||||
use Jeidison\JSignPDF\JSignPDF;
|
||||
use Jeidison\JSignPDF\Sign\JSignParam;
|
||||
use OC\Files\Node\File;
|
||||
use OCA\Signer\Storage\ClientStorage;
|
||||
use OCA\Libresign\Storage\ClientStorage;
|
||||
|
||||
class JSignerHandler
|
||||
class JLibresignHandler
|
||||
{
|
||||
public function signExistingFile(
|
||||
File $inputFile,
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
<?php
|
||||
|
||||
namespace OCA\Signer\Listener;
|
||||
namespace OCA\Libresign\Listener;
|
||||
|
||||
use OCA\Files\Event\LoadSidebar;
|
||||
use OCA\Signer\AppInfo\Application;
|
||||
use OCA\Libresign\AppInfo\Application;
|
||||
use OCP\EventDispatcher\Event;
|
||||
use OCP\EventDispatcher\IEventListener;
|
||||
use OCP\Util;
|
||||
|
|
@ -16,6 +16,6 @@ class LoadSidebarListener implements IEventListener
|
|||
return;
|
||||
}
|
||||
|
||||
Util::addScript(Application::APP_ID, 'signer-tab');
|
||||
Util::addScript(Application::APP_ID, 'libresign-tab');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
<?php
|
||||
|
||||
namespace OCA\Signer\Service;
|
||||
namespace OCA\Libresign\Service;
|
||||
|
||||
use OCA\Signer\AppInfo\Application;
|
||||
use OCA\Signer\Handler\CfsslServerHandler;
|
||||
use OCA\Libresign\AppInfo\Application;
|
||||
use OCA\Libresign\Handler\CfsslServerHandler;
|
||||
use OCP\IAppConfig;
|
||||
|
||||
class AdminSignatureService
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
<?php
|
||||
|
||||
namespace OCA\Signer\Service;
|
||||
namespace OCA\Libresign\Service;
|
||||
|
||||
use OCA\Signer\AppInfo\Application;
|
||||
use OCA\Signer\Handler\CfsslHandler;
|
||||
use OCA\Signer\Storage\ClientStorage;
|
||||
use OCA\Libresign\AppInfo\Application;
|
||||
use OCA\Libresign\Handler\CfsslHandler;
|
||||
use OCA\Libresign\Storage\ClientStorage;
|
||||
use OCP\IConfig;
|
||||
|
||||
class SignatureService
|
||||
|
|
|
|||
|
|
@ -1,21 +1,21 @@
|
|||
<?php
|
||||
|
||||
namespace OCA\Signer\Service;
|
||||
namespace OCA\Libresign\Service;
|
||||
|
||||
use OCA\Signer\Handler\JSignerHandler;
|
||||
use OCA\Signer\Storage\ClientStorage;
|
||||
use OCA\Libresign\Handler\JLibresignHandler;
|
||||
use OCA\Libresign\Storage\ClientStorage;
|
||||
|
||||
class SignerService
|
||||
class LibresignService
|
||||
{
|
||||
/** @var JSignerHandler */
|
||||
private $signerHandler;
|
||||
/** @var JLibresignHandler */
|
||||
private $libresignHandler;
|
||||
|
||||
/** @var ClientStorage */
|
||||
private $clientStorage;
|
||||
|
||||
public function __construct(JSignerHandler $signerHandler, ClientStorage $clientStorage)
|
||||
public function __construct(JLibresignHandler $libresignHandler, ClientStorage $clientStorage)
|
||||
{
|
||||
$this->signerHandler = $signerHandler;
|
||||
$this->libresignHandler = $libresignHandler;
|
||||
$this->clientStorage = $clientStorage;
|
||||
}
|
||||
|
||||
|
|
@ -23,7 +23,7 @@ class SignerService
|
|||
$file = $this->clientStorage->getFile($inputFilePath);
|
||||
$certificate = $this->clientStorage->getFile($certificatePath);
|
||||
|
||||
list($filename, $content) = $this->signerHandler->signExistingFile($file, $certificate, $password);
|
||||
list($filename, $content) = $this->libresignHandler->signExistingFile($file, $certificate, $password);
|
||||
$folder = $this->clientStorage->createFolder($outputFolderPath);
|
||||
$certificateFile = $this->clientStorage->saveFile($filename, $content, $folder);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
|
||||
namespace OCA\Signer\Settings;
|
||||
namespace OCA\Libresign\Settings;
|
||||
|
||||
use OCA\Signer\AppInfo\Application;
|
||||
use OCA\Libresign\AppInfo\Application;
|
||||
use OCP\AppFramework\Http\TemplateResponse;
|
||||
use OCP\BackgroundJob\IJobList;
|
||||
use OCP\IAppConfig;
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
<?php
|
||||
|
||||
namespace OCA\Signer\Storage;
|
||||
namespace OCA\Libresign\Storage;
|
||||
|
||||
use OC\Files\Node\File;
|
||||
use OC\Files\Node\Node;
|
||||
use OCA\Signer\Exception\SignerException;
|
||||
use OCA\Libresign\Exception\LibresignException;
|
||||
use OCP\Files\Folder;
|
||||
|
||||
class ClientStorage
|
||||
|
|
@ -21,7 +21,7 @@ class ClientStorage
|
|||
{
|
||||
$node = $this->getNode($path);
|
||||
if (!$node instanceof File) {
|
||||
throw new SignerException("path {$path} is not a valid file!", 400);
|
||||
throw new LibresignException("path {$path} is not a valid file!", 400);
|
||||
}
|
||||
|
||||
return $node;
|
||||
|
|
@ -35,7 +35,7 @@ class ClientStorage
|
|||
|
||||
$node = $this->storage->get($path);
|
||||
if (!$node instanceof Folder) {
|
||||
throw new SignerException("path {$path} already exists and is not a folder!", 400);
|
||||
throw new LibresignException("path {$path} already exists and is not a folder!", 400);
|
||||
}
|
||||
|
||||
return $node;
|
||||
|
|
@ -50,7 +50,7 @@ class ClientStorage
|
|||
$node = $folder->get($filePath);
|
||||
|
||||
if (!$node instanceof File) {
|
||||
throw new SignerException("path {$filePath} already exists and is not a file!", 400);
|
||||
throw new LibresignException("path {$filePath} already exists and is not a file!", 400);
|
||||
}
|
||||
|
||||
$node->putContent($content);
|
||||
|
|
@ -71,7 +71,7 @@ class ClientStorage
|
|||
private function getNode(string $path): Node
|
||||
{
|
||||
if (!$this->storage->nodeExists($path)) {
|
||||
throw new SignerException("path {$path} is not valid!", 400);
|
||||
throw new LibresignException("path {$path} is not valid!", 400);
|
||||
}
|
||||
|
||||
return $this->storage->get($path);
|
||||
|
|
|
|||
2
package-lock.json
generated
2
package-lock.json
generated
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"name": "signer",
|
||||
"name": "libresign",
|
||||
"version": "1.0.0",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"name": "signer",
|
||||
"name": "Libresign",
|
||||
"description": "A app for signing documents",
|
||||
"version": "1.0.0",
|
||||
"license": "agpl",
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<?php
|
||||
script('signer', 'signer-settings');
|
||||
script('libresign', 'libresign-settings');
|
||||
?>
|
||||
<div id="signer-admin-settings" class="section">
|
||||
<div id="libresign-admin-settings" class="section">
|
||||
</div>
|
||||
|
|
@ -1,9 +1,9 @@
|
|||
<?php
|
||||
|
||||
namespace OCA\Signer\Tests\Unit\Controller;
|
||||
namespace OCA\Libresign\Tests\Unit\Controller;
|
||||
|
||||
use OCA\Signer\Controller\SignatureController;
|
||||
use OCA\Signer\Service\SignatureService;
|
||||
use OCA\Libresign\Controller\SignatureController;
|
||||
use OCA\Libresign\Service\SignatureService;
|
||||
use OCP\IRequest;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Prophecy\PhpUnit\ProphecyTrait;
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
<?php
|
||||
|
||||
namespace OCA\Signer\Tests\Unit\Controller;
|
||||
namespace OCA\Libresign\Tests\Unit\Controller;
|
||||
|
||||
use OC\Files\Node\File;
|
||||
use OCA\Signer\Controller\SignerController;
|
||||
use OCA\Signer\Service\SignerService;
|
||||
use OCA\Libresign\Controller\LibresignController;
|
||||
use OCA\Libresign\Service\LibresignService;
|
||||
use OCP\IRequest;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Prophecy\PhpUnit\ProphecyTrait;
|
||||
|
|
@ -13,14 +13,14 @@ use Prophecy\PhpUnit\ProphecyTrait;
|
|||
* @internal
|
||||
* @coversNothing
|
||||
*/
|
||||
final class SignerControllerTest extends TestCase
|
||||
final class LibresignControllerTest extends TestCase
|
||||
{
|
||||
use ProphecyTrait;
|
||||
public function testSignFile()
|
||||
{
|
||||
$userId = 'john';
|
||||
$request = $this->prophesize(IRequest::class);
|
||||
$service = $this->prophesize(SignerService::class);
|
||||
$service = $this->prophesize(LibresignService::class);
|
||||
$file = $this->prophesize(File::class);
|
||||
$file->getInternalPath()->willReturn("/path/to/someFileSigned");
|
||||
|
||||
|
|
@ -34,7 +34,7 @@ final class SignerControllerTest extends TestCase
|
|||
->willReturn($file->reveal())
|
||||
;
|
||||
|
||||
$controller = new SignerController(
|
||||
$controller = new LibresignController(
|
||||
$request->reveal(),
|
||||
$service->reveal(),
|
||||
$userId
|
||||
|
|
@ -70,12 +70,12 @@ final class SignerControllerTest extends TestCase
|
|||
){
|
||||
$userId = 'john';
|
||||
$request = $this->prophesize(IRequest::class);
|
||||
$service = $this->prophesize(SignerService::class);
|
||||
$service = $this->prophesize(LibresignService::class);
|
||||
|
||||
$service->sign(\Prophecy\Argument::cetera())
|
||||
->shouldNotBeCalled();
|
||||
|
||||
$controller = new SignerController(
|
||||
$controller = new LibresignController(
|
||||
$request->reveal(),
|
||||
$service->reveal(),
|
||||
$userId
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
<?php
|
||||
|
||||
namespace OCA\Signer\Tests\Unit\Service;
|
||||
namespace OCA\Libresign\Tests\Unit\Service;
|
||||
|
||||
use OCA\Signer\Handler\CfsslHandler;
|
||||
use OCA\Signer\Service\SignatureService;
|
||||
use OCA\Signer\Storage\ClientStorage;
|
||||
use OCA\Libresign\Handler\CfsslHandler;
|
||||
use OCA\Libresign\Service\SignatureService;
|
||||
use OCA\Libresign\Storage\ClientStorage;
|
||||
use OCP\IConfig;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Prophecy\PhpUnit\ProphecyTrait;
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
<?php
|
||||
|
||||
namespace OCA\Signer\Tests\Unit\Service;
|
||||
namespace OCA\Libresign\Tests\Unit\Service;
|
||||
|
||||
use OCA\Signer\Handler\JSignerHandler;
|
||||
use OCA\Signer\Service\SignerService;
|
||||
use OCA\Signer\Storage\ClientStorage;
|
||||
use OCA\Libresign\Handler\JLibresignHandler;
|
||||
use OCA\Libresign\Service\LibresignService;
|
||||
use OCA\Libresign\Storage\ClientStorage;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Prophecy\PhpUnit\ProphecyTrait;
|
||||
|
||||
|
|
@ -12,7 +12,7 @@ use Prophecy\PhpUnit\ProphecyTrait;
|
|||
* @internal
|
||||
* @coversNothing
|
||||
*/
|
||||
final class SignerServiceTest extends TestCase
|
||||
final class LibresignServiceTest extends TestCase
|
||||
{
|
||||
use ProphecyTrait;
|
||||
public function testSignFile()
|
||||
|
|
@ -21,7 +21,7 @@ final class SignerServiceTest extends TestCase
|
|||
$outputFolderPath = '/path/to/someOutputFolderPath';
|
||||
$certificatePath = '/path/to/someCertificatePath';
|
||||
$password = 'somePassword';
|
||||
$signerHandler = $this->prophesize(JSignerHandler::class);
|
||||
$libresignHandler = $this->prophesize(JLibresignHandler::class);
|
||||
$clientStorage = $this->prophesize(ClientStorage::class);
|
||||
|
||||
$filename = 'someFilename';
|
||||
|
|
@ -35,7 +35,7 @@ final class SignerServiceTest extends TestCase
|
|||
->shouldBeCalled()
|
||||
;
|
||||
|
||||
$signerHandler->signExistingFile(\Prophecy\Argument::any(), \Prophecy\Argument::any(), $password)
|
||||
$libresignHandler->signExistingFile(\Prophecy\Argument::any(), \Prophecy\Argument::any(), $password)
|
||||
->shouldBeCalled()
|
||||
->willReturn([$filename, $content])
|
||||
;
|
||||
|
|
@ -48,7 +48,7 @@ final class SignerServiceTest extends TestCase
|
|||
->shouldBeCalled()
|
||||
;
|
||||
|
||||
$service = new SignerService($signerHandler->reveal(), $clientStorage->reveal());
|
||||
$service = new LibresignService($libresignHandler->reveal(), $clientStorage->reveal());
|
||||
$service->sign($inputFilePath, $outputFolderPath, $certificatePath, $password);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,4 +4,4 @@ require_once __DIR__.'/../../../lib/base.php';
|
|||
require_once __DIR__.'/../vendor/autoload.php';
|
||||
|
||||
\OC::$loader->addValidRoot(OC::$SERVERROOT . '/tests');
|
||||
\OC_App::loadApp('signer');
|
||||
\OC_App::loadApp('libresign');
|
||||
Loading…
Add table
Reference in a new issue