chore: move PHP tests to php folder

This will make more easy to use Rector tool.

https://packagist.org/packages/nextcloud/rector

Signed-off-by: Vitor Mattos <vitor@php.rio>

Signed-off-by: Vitor Mattos <vitor@php.rio>
This commit is contained in:
Vitor Mattos 2025-05-21 09:07:12 -03:00
parent 15267fb991
commit b0720c986a
No known key found for this signature in database
GPG key ID: B7AB4B76A7CA7318
56 changed files with 60 additions and 36 deletions

View file

@ -28,15 +28,15 @@ Files: .devcontainer/devcontainer.json
openapi.json
package-lock.json
package.json
phpunit.xml
psalm.xml
src/types/openapi/openapi-administration.ts
src/types/openapi/openapi-full.ts
src/types/openapi/openapi.ts
tests/Unit/Handler/mock/cert.json
tests/fixtures/cfssl/newcert-with-success.json
tests/fixtures/small_valid-signed.pdf
tests/fixtures/small_valid.pdf
tests/php/phpunit.xml
tests/php/Unit/Handler/mock/cert.json
tests/php/fixtures/cfssl/newcert-with-success.json
tests/php/fixtures/small_valid-signed.pdf
tests/php/fixtures/small_valid.pdf
tests/integration/composer.json
tests/integration/composer.lock
tests/integration/features/*/*.feature

View file

@ -44,8 +44,8 @@
"post-update-cmd": [
"composer dump-autoload"
],
"test:unit": "vendor/bin/phpunit --no-coverage",
"test:coverage": "XDEBUG_MODE=coverage vendor/bin/phpunit"
"test:unit": "vendor/bin/phpunit -c tests/php/phpunit.xml --no-coverage --colors=always --fail-on-warning --fail-on-risky --display-deprecations --display-phpunit-deprecations",
"test:coverage": "XDEBUG_MODE=coverage vendor/bin/phpunit -c tests/php/phpunit.xml"
},
"extra": {
"bamarni-bin": {

View file

@ -48,7 +48,7 @@ class DevelopController extends Controller {
if (!$this->isDebugMode()) {
return new DataResponse([], Http::STATUS_NOT_FOUND);
}
$file = new InMemoryFile('file.pdf', file_get_contents(__DIR__ . '/../../tests/fixtures/small_valid.pdf'));
$file = new InMemoryFile('file.pdf', file_get_contents(__DIR__ . '/../../tests/php/fixtures/small_valid.pdf'));
$response = new FileDisplayResponse($file);
$response->setHeaders([
'Content-Disposition' => 'inline; filename="file.pdf"',

View file

@ -147,7 +147,7 @@ final class JSignPdfHandlerTest extends \OCA\Libresign\Tests\Unit\TestCase {
);
$this->signatureBackgroundService->method('getImagePath')->willReturn(
realpath(__DIR__ . '/../../../../img/LibreSign.png')
realpath(__DIR__ . '/../../../../../img/LibreSign.png')
);
$this->appConfig->setValueFloat('libresign', 'template_font_size', $templateFontSize);
@ -199,7 +199,7 @@ final class JSignPdfHandlerTest extends \OCA\Libresign\Tests\Unit\TestCase {
'lly' => 0,
'urx' => 0,
'ury' => 0,
], realpath(__DIR__ . '/../../../../img/app-dark.png'))],
], realpath(__DIR__ . '/../../../../../img/app-dark.png'))],
'signatureWidth' => 100,
'signatureHeight' => 100,
'template' => '',
@ -217,7 +217,7 @@ final class JSignPdfHandlerTest extends \OCA\Libresign\Tests\Unit\TestCase {
'lly' => 20,
'urx' => 30,
'ury' => 40,
], realpath(__DIR__ . '/../../../../img/app-dark.png'))],
], realpath(__DIR__ . '/../../../../../img/app-dark.png'))],
'signatureWidth' => 20,
'signatureHeight' => 20,
'template' => '',
@ -235,7 +235,7 @@ final class JSignPdfHandlerTest extends \OCA\Libresign\Tests\Unit\TestCase {
'lly' => 20,
'urx' => 30,
'ury' => 40,
], realpath(__DIR__ . '/../../../../img/app-dark.png'))],
], realpath(__DIR__ . '/../../../../../img/app-dark.png'))],
'signatureWidth' => 20,
'signatureHeight' => 20,
'template' => 'aaaaa',
@ -253,7 +253,7 @@ final class JSignPdfHandlerTest extends \OCA\Libresign\Tests\Unit\TestCase {
'lly' => 20,
'urx' => 30,
'ury' => 40,
], realpath(__DIR__ . '/../../../../img/app-dark.png'))],
], realpath(__DIR__ . '/../../../../../img/app-dark.png'))],
'signatureWidth' => 20,
'signatureHeight' => 20,
'template' => 'aaaaa',
@ -271,7 +271,7 @@ final class JSignPdfHandlerTest extends \OCA\Libresign\Tests\Unit\TestCase {
'lly' => 20,
'urx' => 30,
'ury' => 40,
], realpath(__DIR__ . '/../../../../img/app-dark.png'))],
], realpath(__DIR__ . '/../../../../../img/app-dark.png'))],
'signatureWidth' => 20,
'signatureHeight' => 20,
'template' => 'aaaaa',
@ -289,7 +289,7 @@ final class JSignPdfHandlerTest extends \OCA\Libresign\Tests\Unit\TestCase {
'lly' => 20,
'urx' => 30,
'ury' => 40,
], realpath(__DIR__ . '/../../../../img/app-dark.png'))],
], realpath(__DIR__ . '/../../../../../img/app-dark.png'))],
'signatureWidth' => 20,
'signatureHeight' => 20,
'template' => 'aaaaa',
@ -307,7 +307,7 @@ final class JSignPdfHandlerTest extends \OCA\Libresign\Tests\Unit\TestCase {
'lly' => 100,
'urx' => 351,
'ury' => 200,
], realpath(__DIR__ . '/../../../../img/app-dark.png'))],
], realpath(__DIR__ . '/../../../../../img/app-dark.png'))],
'signatureWidth' => 350,
'signatureHeight' => 100,
'template' => 'aaaaa',
@ -325,7 +325,7 @@ final class JSignPdfHandlerTest extends \OCA\Libresign\Tests\Unit\TestCase {
'lly' => 20,
'urx' => 30,
'ury' => 40,
], realpath(__DIR__ . '/../../../../img/app-dark.png'))],
], realpath(__DIR__ . '/../../../../../img/app-dark.png'))],
'signatureWidth' => 20,
'signatureHeight' => 20,
'template' => 'aaaaa',
@ -361,7 +361,7 @@ final class JSignPdfHandlerTest extends \OCA\Libresign\Tests\Unit\TestCase {
'lly' => 20,
'urx' => 30,
'ury' => 40,
], realpath(__DIR__ . '/../../../../img/app-dark.png'))],
], realpath(__DIR__ . '/../../../../../img/app-dark.png'))],
'signatureWidth' => 20,
'signatureHeight' => 20,
'template' => '',

View file

@ -91,7 +91,7 @@ final class PdfParseServiceTest extends \OCA\Libresign\Tests\Unit\TestCase {
return [
[
'disablePdfInfo' => true,
'tests/fixtures/small_valid.pdf',
'tests/php/fixtures/small_valid.pdf',
[
'p' => 1,
'd' => [
@ -101,7 +101,7 @@ final class PdfParseServiceTest extends \OCA\Libresign\Tests\Unit\TestCase {
],
[
'disablePdfInfo' => true,
'tests/fixtures/small_valid-signed.pdf',
'tests/php/fixtures/small_valid-signed.pdf',
[
'p' => 1,
'd' => [
@ -111,7 +111,7 @@ final class PdfParseServiceTest extends \OCA\Libresign\Tests\Unit\TestCase {
],
[
'disablePdfInfo' => false,
'tests/fixtures/small_valid.pdf',
'tests/php/fixtures/small_valid.pdf',
[
'p' => 1,
'd' => [
@ -121,7 +121,7 @@ final class PdfParseServiceTest extends \OCA\Libresign\Tests\Unit\TestCase {
],
[
'disablePdfInfo' => false,
'tests/fixtures/small_valid-signed.pdf',
'tests/php/fixtures/small_valid-signed.pdf',
[
'p' => 1,
'd' => [

View file

@ -1,21 +1,26 @@
<?php
declare(strict_types=1);
/**
* SPDX-FileCopyrightText: 2020-2024 LibreCode coop and contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
declare(strict_types=1);
use OCP\App\IAppManager;
use OCP\Server;
if (!defined('PHPUNIT_RUN')) {
define('PHPUNIT_RUN', 1);
}
require_once __DIR__ . '/../../../lib/base.php';
require_once __DIR__ . '/../vendor/autoload.php';
require_once __DIR__ . '/../../../../lib/base.php';
require_once __DIR__ . '/../../../../tests/autoload.php';
\OC::$composerAutoloader->addPsr4('Test\\', OC::$SERVERROOT . '/tests/lib/', true);
\OC::$composerAutoloader->addPsr4('Tests\\', OC::$SERVERROOT . '/tests/', true);
\OC::$composerAutoloader->addPsr4('Test\\', OC::$SERVERROOT . '/tests/php/lib/', true);
\OC::$composerAutoloader->addPsr4('Tests\\', OC::$SERVERROOT . '/tests/php/', true);
\OC::$composerAutoloader->addPsr4('OCA\\Libresign\\Tests\\', __DIR__, true);
\OC_App::loadApp('libresign');
Server::get(IAppManager::class)->loadApp('libresign');
OC_Hook::clear();

View file

@ -1,35 +1,35 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd"
bootstrap="tests/bootstrap.php"
bootstrap="bootstrap.php"
executionOrder="depends,defects"
beStrictAboutOutputDuringTests="true"
failOnRisky="true"
failOnWarning="true"
colors="true"
cacheDirectory="build/logs/.phpunit.cache"
cacheDirectory="../../build/logs/.phpunit.cache"
displayDetailsOnTestsThatTriggerWarnings="true"
beStrictAboutCoverageMetadata="true">
<testsuites>
<testsuite name="api">
<directory suffix="Test.php">tests/Api</directory>
<directory suffix="Test.php">Api</directory>
</testsuite>
<testsuite name="unit">
<directory suffix="Test.php">tests/Unit</directory>
<directory suffix="Test.php">Unit</directory>
</testsuite>
</testsuites>
<coverage>
<report>
<clover outputFile="build/logs/clover.xml"/>
<html outputDirectory="build/logs/html-coverage" lowUpperBound="50" highLowerBound="90"/>
<clover outputFile="../../build/logs/clover.xml"/>
<html outputDirectory="../../build/logs/html-coverage" lowUpperBound="50" highLowerBound="90"/>
</report>
</coverage>
<source>
<include>
<directory suffix=".php">lib</directory>
<directory suffix=".php">../../lib</directory>
</include>
<exclude>
<directory suffix=".php">lib/Migration</directory>
<directory suffix=".php">../../lib/Migration</directory>
</exclude>
</source>
</phpunit>

View file

@ -0,0 +1 @@
{}

18
vendor-bin/rector/composer.lock generated Normal file
View file

@ -0,0 +1,18 @@
{
"_readme": [
"This file locks the dependencies of your project to a known state",
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "d751713988987e9331980363e24189ce",
"packages": [],
"packages-dev": [],
"aliases": [],
"minimum-stability": "stable",
"stability-flags": {},
"prefer-stable": false,
"prefer-lowest": false,
"platform": {},
"platform-dev": {},
"plugin-api-version": "2.6.0"
}