adachsoft / task-functional-tests
Functional contract tests for adachsoft/task-contracts implementations
Requires
- php: ^8.3
- adachsoft/task-contracts: ^3.0
- phpunit/phpunit: ^13.1
Requires (Dev)
- adachsoft/php-code-style: ^0.7
- adachsoft/rule-evaluator-expression-language: ^0.1
- friendsofphp/php-cs-fixer: ^3.95
- phpstan/phpstan: ^2.2
- rector/rector: ^2.6
- symplify/phpstan-rules: ^14.17
Suggests
None
Provides
None
Conflicts
None
Replaces
None
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-contracts3.0 (^3.0@rcwhile 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.