Search by

adachsoft / task-functional-tests

Arkadiusz Adach

Functional contract tests for adachsoft/task-contracts implementations

Package info

gitlab.com/a.adach/task-functional-tests

Issues

pkg:composer/adachsoft/task-functional-tests

Statistics

Installs: 13

Dependents: 2

Suggesters: 0

Stars: 0

v3.0.0 2026-11-16 05:31 UTC

This package is auto-updated.

Last update: 2026-11-16 04:35:21 UTC


README

Functional PHPUnit contract tests for implementations of adachsoft/task-contracts.

Requirements

  • PHP 8.3 or newer
  • adachsoft/task-contracts 3.0 (^3.0@rc while 3.0 is a release candidate)
  • PHPUnit 13.1 or newer to run the tests

Installation

Install the package as a development dependency in the project that provides the repository implementations:

composer require --dev adachsoft/task-functional-tests

Using a contract test

Extend the contract test for the interface implemented by your adapter and return a fresh repository from its factory method. Replace MyTaskRepository with your implementation and provide any constructor dependencies it needs.

<?php

declare(strict_types=1);

namespace App\Tests\Contract;

use AdachSoft\TaskContracts\Interface\TaskRepositoryInterface;
use AdachSoft\TaskFunctionalTests\Repository\AbstractTaskRepositoryContractTest;
use App\Repository\MyTaskRepository;

final class MyTaskRepositoryContractTest extends AbstractTaskRepositoryContractTest
{
    protected function createRepository(): TaskRepositoryInterface
    {
        return new MyTaskRepository();
    }
}

The abstract contract suites cover:

  • AbstractTaskRepositoryContractTest — task persistence and retrieval.
  • AbstractTaskRepositorySearchContractTest — task search, filtering, sorting, and pagination.
  • AbstractCommentRepositoryContractTest — comment persistence and retrieval.
  • AbstractTaskStatusResolverContractTest — workflow-aware task status resolution.
  • AbstractAttachmentRepositoryContractTest — attachment metadata persistence and lookup.
  • AbstractAttachmentContentStorageContractTest — binary attachment content storage.
  • AbstractWorkflowDefinitionRepositoryContractTest — workflow definition lookup and consistency validation.
  • AbstractTaskTypeDefinitionRepositoryContractTest — task type definition lookup, default selection, and consistency validation.

Resolver implementations should use TaskRepositoryInterface and a WorkflowResolver backed by their task-type and workflow definition repositories.

Running the self-test

The repository includes in-memory implementations from task-contracts 3.0 and a PHPUnit suite named contract:

composer install
vendor/bin/phpunit --testsuite contract

License

This project is released under the MIT License.