Skip to content

[stable32] refactor: consolidate pdf fixtures#6198

Merged
vitormattos merged 13 commits intostable32from
backport/6197/stable32
Dec 15, 2025
Merged

[stable32] refactor: consolidate pdf fixtures#6198
vitormattos merged 13 commits intostable32from
backport/6197/stable32

Conversation

@backportbot-libresign
Copy link
Copy Markdown

Backport of PR #6197

Consolidate PDF fixture generation into a single static class:
- Migrate all methods from PdfFixtureTrait to PdfGenerator
- Convert trait methods to public static methods
- Maintain all existing functionality
- Includes 20+ methods for ISO 32000-1 edge case testing

This improves code organization and eliminates trait usage.

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Delete trait after migrating all methods to PdfGenerator.
The trait pattern was unnecessary for stateless utility methods.

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Replace PdfFixtureTrait usage with PdfGenerator static methods:
- Remove 'use PdfFixtureTrait' statements
- Add 'use OCA\Libresign\Tests\Fixtures\PdfGenerator' imports
- Change trait method calls to static PdfGenerator:: calls
- Fix incorrect PdfGenerator::createMock() to $this->createMock()

Affected test files:
- DocMdpHandlerTest
- FileServiceTest (3 createMock fixes)
- SignFileServiceTest (20+ createMock fixes)
- PdfParseServiceTest
- PdfSignatureDetectionServiceTest
- RequestSignatureServiceTest
- ValidateHelperTest
- AEnvironmentPageAwareControllerTest

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Replace PdfFixtureTrait with PdfGenerator in API tests:
- FileControllerTest
- FileElementControllerTest
- IdDocsControllerTest
- NotifyControllerTest
- RequestSignatureControllerTest
- SignFileControllerTest

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Clean up test code by:
- Removing verbose docblocks and obvious comments
- Simplifying assertion messages
- Deleting 2 redundant tests (extraction and validation)
- Reducing file size from 180 to 46 lines (74% reduction)

All 21 tests still pass with maintained coverage.

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Create catalog system for managing real-world signed PDFs:
- PdfFixtureCatalog class with YAML-based metadata
- Filter by DocMDP level, TSA, signature tool, count
- Provides expected validation results for tests
- Includes PdfFixture wrapper for easy access
- Store real PDFs in tests/php/fixtures/pdfs/ directory

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Delete PDFs from root fixtures directory.
Files now organized in tests/php/fixtures/pdfs/ with catalog.

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Update composer.json and Pkcs12Handler changes from refactoring.

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Add SPDX license and copyright headers to comply with REUSE specification.

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Update path from tests/php/fixtures/small_valid.pdf to
tests/php/fixtures/pdfs/small_valid.pdf after file reorganization.

Fixes /apps/libresign/develop/pdf route.

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Update paths to reflect new organization in pdfs/ subdirectory:
- tests/php/fixtures/real_jsignpdf_level1.pdf -> tests/php/fixtures/pdfs/real_jsignpdf_level1.pdf
- tests/php/fixtures/small_valid-signed.pdf -> tests/php/fixtures/pdfs/small_valid-signed.pdf
- tests/php/fixtures/small_valid.pdf -> tests/php/fixtures/pdfs/small_valid.pdf

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
@github-project-automation github-project-automation Bot moved this to 0. Needs triage in Roadmap Dec 15, 2025
@backportbot-libresign backportbot-libresign Bot added this to the Next Patch (32) milestone Dec 15, 2025
@vitormattos vitormattos merged commit 3009f9f into stable32 Dec 15, 2025
62 checks passed
@vitormattos vitormattos deleted the backport/6197/stable32 branch December 15, 2025 19:26
@github-project-automation github-project-automation Bot moved this from 0. Needs triage to 4. to release in Roadmap Dec 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

1 participant