Skip to content

Expand test coverage for controllers and services #37

@CybotTM

Description

@CybotTM

Description

Currently, the extension has limited test coverage (~25%) with tests only for domain models. We need comprehensive test coverage for controllers, services, commands, and repositories.

Current State

Tested (4 files):

  • Domain models only (Component, Environment, Translation, Type)

Not Tested:

  • Controllers (TranslationController)
  • Services (TranslationService, ImportService)
  • ViewHelpers (TextdbViewHelper, TranslateViewHelper)
  • Command classes (ImportCommand)
  • Repositories (query methods)

Proposed Changes

1. Controller Tests

  • Tests/Unit/Controller/TranslationControllerTest.php
  • Test all actions: list, translated, translateRecord, import, export
  • Mock dependencies (repositories, services)

2. Service Tests

  • Tests/Unit/Service/TranslationServiceTest.php
  • Tests/Unit/Service/ImportServiceTest.php
  • Test business logic and error handling

3. Functional Tests

  • Tests/Functional/Domain/Repository/ - Test repository queries
  • Tests/Functional/Service/ - Test import/export workflows
  • Use fixtures and database state

4. ViewHelper Tests

  • Tests/Unit/ViewHelpers/TextdbViewHelperTest.php
  • Tests/Unit/ViewHelpers/TranslateViewHelperTest.php

Acceptance Criteria

  • Test coverage reaches 60%+
  • All controllers have unit tests
  • All services have unit tests with mocking
  • Functional tests for import/export workflows
  • Repository query methods have functional tests
  • PHPUnit configuration for functional tests exists
  • CI pipeline runs all tests successfully

Priority

High - Improves code quality and prevents regressions

Related

TYPO3 Conformance Report: Testing Standards score 17/20 (can reach 20/20 with proper coverage)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions