Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
110 changes: 78 additions & 32 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,24 @@
/></a>
</h1>

[![PHPStan](https://github.com/The-FireHub-Project/Testing/actions/workflows/PHPStan.yml/badge.svg?branch=feature%2Ftesting-infrastructure)](https://github.com/The-FireHub-Project/Testing/actions/workflows/PHPStan.yml)
[![PHPUnit](https://github.com/The-FireHub-Project/Testing/actions/workflows/PHPUnit.yml/badge.svg?branch=feature%2Ftesting-infrastructure)](https://github.com/The-FireHub-Project/Testing/actions/workflows/PHPUnit.yml)
[![Codecov](https://codecov.io/gh/The-FireHub-Project/Testing/branch/feature%2Ftesting-infrastructure/graph/badge.svg?token=XW2YEONF51)](https://app.codecov.io/gh/The-FireHub-Project/Testing/tree/feature%2Ftesting-infrastructure)

<p>
<a href="https://github.com/The-FireHub-Project/Testing/commits/develop/">
<a href="https://github.com/The-FireHub-Project/Testing/commits/feature/testing-infrastructure/">
<img
src="https://img.shields.io/github/last-commit/The-FireHub-Project/Testing/develop?style=flat&logo=github&logoColor=959da5&label=last%20commit%20(branch)&labelColor=31373e"
src="https://img.shields.io/github/last-commit/The-FireHub-Project/Testing/feature/testing-infrastructure?style=flat&logo=github&logoColor=959da5&label=last%20commit%20(branch)&labelColor=31373e"
alt="GitHub last commit (branch)"
/></a>
<a href="https://github.com/The-FireHub-Project/Testing/commits/develop/">
<a href="https://github.com/The-FireHub-Project/Testing/commits/feature/testing-infrastructure/">
<img
src="https://img.shields.io/github/commit-activity/m/The-FireHub-Project/Testing/develop?style=flat&logo=github&logoColor=959da5&label=commit%20activity%20(branch)&labelColor=31373e"
src="https://img.shields.io/github/commit-activity/m/The-FireHub-Project/Testing/feature/testing-infrastructure?style=flat&logo=github&logoColor=959da5&label=commit%20activity%20(branch)&labelColor=31373e"
alt="GitHub activity (branch)"
/></a>
<a href="https://github.com/The-FireHub-Project/Testing/compare/master...develop/">
<a href="https://github.com/The-FireHub-Project/Testing/compare/develop...feature/testing-infrastructure/">
<img
src="https://img.shields.io/github/commits-difference/The-FireHub-Project/Testing?base=master&head=develop&style=flat&logo=github&logoColor=959da5&label=ahead%20master&labelColor=31373e"
src="https://img.shields.io/github/commits-difference/The-FireHub-Project/Testing?base=develop&head=feature/testing-infrastructure&style=flat&logo=github&logoColor=959da5&label=ahead%20develop&labelColor=31373e"
alt="GitHub commit difference between two branches"
/></a>
</p>
Expand All @@ -55,47 +59,89 @@ This layer is designed to ensure that FireHub architectural rules are continuous

---

## <img src="https://raw.githubusercontent.com/The-FireHub-Project/the-firehub-project.github.io/master/resources/graphics/icons/firehub.svg" width="15" alt="FireHub Icon"> Development Branch
## <img src="https://raw.githubusercontent.com/The-FireHub-Project/the-firehub-project.github.io/master/resources/graphics/icons/firehub.svg" width="15" alt="FireHub Icon"> Testing infrastructure – Development Branch

⚠️ **This is the `develop` branch**
⚠️ **This is the `development` branch**

- Unstable
- APIs may change without notice
- Not intended for production use

### Related

- Target Release: **v0.0.0**
- Repository: FireHub Testing Toolkit

### Pull request

<p>
<a href="https://github.com/The-FireHub-Project/Testing/pull/4/">
<img
src="https://img.shields.io/github/pulls/detail/title/The-FireHub-Project/Testing/4?style=flat&logo=github&logoColor=959da5&label=title&labelColor=31373e"
alt="GitHub pull request title"
/></a>
<a href="https://github.com/The-FireHub-Project/Testing/pull/4/">
<img
src="https://img.shields.io/github/pulls/detail/author/The-FireHub-Project/Testing/4?style=flat&logo=github&logoColor=959da5&labelColor=31373e"
alt="GitHub pull request author"
/></a>
<a href="https://github.com/The-FireHub-Project/Testing/pull/4/">
<img
src="https://img.shields.io/github/pulls/detail/age/The-FireHub-Project/Testing/4?style=flat&logo=github&logoColor=959da5&labelColor=31373e"
alt="GitHub pull request created"
/></a>
<a href="https://github.com/The-FireHub-Project/Testing/pull/4/">
<img
src="https://img.shields.io/github/pulls/detail/comments/The-FireHub-Project/Testing/4?style=flat&logo=github&logoColor=959da5&labelColor=31373e"
alt="GitHub pull request comments"
/></a>
</p>

## <img src="https://raw.githubusercontent.com/The-FireHub-Project/the-firehub-project.github.io/master/resources/graphics/icons/firehub.svg" width="15" alt="FireHub Icon"> Branch Purpose

The `develop` branch is the **primary integration branch** for all ongoing development.
Introduce the `the-firehub-project/testing` package as a shared testing infrastructure library for the FireHub ecosystem.

This branch establishes a centralized location for reusable testing components such as Data Providers, Stubs, Fixtures, and common testing utilities that can be consumed by FireHub Core, Runtime, Adapter, and Capability repositories.

The goal is to avoid duplicated test infrastructure across repositories and provide a consistent testing foundation across the entire ecosystem.

## <img src="https://raw.githubusercontent.com/The-FireHub-Project/the-firehub-project.github.io/master/resources/graphics/icons/firehub.svg" width="15" alt="FireHub Icon"> Architectural Goal

Create a framework-agnostic testing support layer that sits outside the production runtime while supporting all FireHub packages during development and verification.

The Testing package should:

- Provide reusable test building blocks shared across repositories.
- Keep testing concerns separated from Core contracts and Runtime execution logic.
- Support multiple testing frameworks without coupling the package to a specific runner.
- Improve the consistency, maintainability, and scalability of the FireHub test ecosystem.
- Enable isolated testing of contracts, implementations, adapters, and capabilities.

## <img src="https://raw.githubusercontent.com/The-FireHub-Project/the-firehub-project.github.io/master/resources/graphics/icons/firehub.svg" width="15" alt="FireHub Icon"> Core Concept

The Testing package provides reusable verification components instead of application logic.

It serves as the staging area where:
- Feature branches are merged
- Bug fixes are integrated
- Experimental work is stabilized
- Code is prepared for upcoming releases
Core concepts:

All **release branches** are created **from `develop`**.
- **Data Providers**
- Shared datasets for repeatable test scenarios.
- Standardized valid, invalid, boundary, and edge-case inputs.

## Stability Guarantee
- **Stubs**
- Lightweight implementations of contracts used to isolate behavior during testing.
- Used instead of production implementations when testing individual units.

❌ No backward compatibility guarantee
❌ APIs may change without notice
❌ Behavior may be incomplete or inconsistent
❌ Breaking changes are expected
- **Fixtures**
- Reusable object and state creation helpers for complex test scenarios.

This branch is intended **only for contributors and advanced testers**.
- **Testing Utilities**
- Common assertions, helpers, and test support functionality.

## <img src="https://raw.githubusercontent.com/The-FireHub-Project/the-firehub-project.github.io/master/resources/graphics/icons/firehub.svg" width="15" alt="FireHub Icon"> Composer Usage (Not Recommended)
The package follows the principle:

For internal testing only:
> Production code defines behavior. Testing infrastructure verifies behavior.

```json
{
"require": {
"the-firehub-project/testing": "dev-develop"
}
}
```
⚠️ Never use dev-develop in production.
The Testing package must never become a dependency of runtime execution. It exists only as a development and verification dependency.

## <img src="https://raw.githubusercontent.com/The-FireHub-Project/the-firehub-project.github.io/master/resources/graphics/icons/firehub.svg" width="15" alt="FireHub Icon"> Authors and Contributors

Expand All @@ -110,6 +156,6 @@ Architecture guidelines, design principles, and ecosystem documentation are avai

## <img src="https://raw.githubusercontent.com/The-FireHub-Project/the-firehub-project.github.io/master/resources/graphics/icons/firehub.svg" width="15" alt="FireHub Icon"> License

This software is licensed under the MIT License.
This software is licensed under the Apache-2.0 License.

For more details, read the full license [here](./LICENSE).
67 changes: 67 additions & 0 deletions src/DataProviders/ArrDataProvider.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<?php declare(strict_types = 1);

/**
* This file is part of the FireHub Project ecosystem
*
* @author Danijel Galić <danijel.galic@outlook.com>
* @copyright 2026-present The FireHub Project - All rights reserved
* @license https://opensource.org/license/MIT MIT License
*
* @php-version >=7.4
* @package Testing
*/

namespace FireHub\Testing\DataProviders;

/**
* ### Array data provider
* @since 1.0.0
*/
final class ArrDataProvider {

/**
* @since 1.0.0
*
* @return array<list>
*/
public static function list ():array {

return [
[[1, 2, 3]],
[[10.2, 200, -3]],
[['x', 'y', 'z']],
[[]]
];

}

/**
* @since 1.0.0
*
* @return array<array>
*/
public static function associative ():array {

return [
[['one' => 1, 'two' => 2, 'three' => 3]],
[['ONE' => 1, 'TWO' => 2, 'THREE' => 3]],
[[2 => '', 'x' => null, 5 => false]]
];

}

/**
* @since 1.0.0
*
* @return array<array>
*/
public static function multidimensional ():array {

return [
[['one' => [1, 2, 3], 'two' => [4, 5, 6], 'three' => [7, 8, 9]]],
[[1 => [1 => null, 2 => false], 2 => [1 => true, 'x' => false]]]
];

}

}
39 changes: 39 additions & 0 deletions src/DataProviders/ConstantDataProvider.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?php declare(strict_types = 1);

/**
* This file is part of the FireHub Project ecosystem
*
* @author Danijel Galić <danijel.galic@outlook.com>
* @copyright 2026-present The FireHub Project - All rights reserved
* @license https://opensource.org/license/MIT MIT License
*
* @php-version >=7.4
* @package Testing
*/

namespace FireHub\Testing\DataProviders;

/**
* ### Constant data provider
* @since 1.0.0
*/
final class ConstantDataProvider {

/**
* @since 1.0.0
*
* @return array<array<non-empty-string, mixed>>
*/
public static function types ():array {

return [
['testString', 'test'],
['testInt', 10],
['testBool', false],
['testNull', null],
['testArray', ['x']]
];

}

}
Loading