An open API service indexing awesome lists of open source software.

https://github.com/php-testo/testo

The Testing Framework
https://github.com/php-testo/testo

hacktoberfest

Last synced: about 1 month ago
JSON representation

The Testing Framework

Awesome Lists containing this project

README

          


TESTO

The PHP Testing Framework You Control

[![Documentation](https://img.shields.io/badge/Documentation-blue?style=for-the-badge&logo=gitbook&logoColor=white)](https://php-testo.github.io)
[![Support on Boosty](https://img.shields.io/static/v1?style=for-the-badge&label=&message=Sponsorship&logo=Boosty&logoColor=white&color=%23F15F2C)](https://boosty.to/roxblnfk)


Testo is an extensible testing framework built on a lightweight core with a middleware system.
It gives you full control over your testing environment while keeping the familiar PHP syntax you already know.

## Get Started

### Installation

```bash
composer require --dev testo/testo *
```

[![PHP](https://img.shields.io/packagist/php-v/testo/testo.svg?style=flat-square&logo=php)](https://packagist.org/packages/testo/testo)
[![Latest Version on Packagist](https://img.shields.io/packagist/v/testo/testo.svg?style=flat-square&logo=packagist)](https://packagist.org/packages/testo/testo)
[![License](https://img.shields.io/packagist/l/testo/testo.svg?style=flat-square)](LICENSE.md)
[![Total Destroys](https://img.shields.io/packagist/dt/testo/testo.svg?style=flat-square)](https://packagist.org/packages/testo/testo/stats)

### Configuration

The fastest way to set up Testo in your project is the built-in `init` command:

```bash
vendor/bin/testo init
```

It will:

- detect your `src/` directory (or prompt for it),
- create `tests/Unit/` if missing,
- generate a minimal `testo.php` next to your `composer.json`,
- register `composer test` and `composer test:` scripts.

For a sub-app layout, point it at the project root: `vendor/bin/testo init --path=app`.

#### Tuning `testo.php` manually

`testo.php` is plain PHP returning an `ApplicationConfig` — edit it freely to add suites, plugins, or coverage. A typical setup looks like:

```php
makeExternalApiCall();

Assert::same($response->status, 200);
}

#[ExpectException(\RuntimeException::class)]
public function throwsException(): void
{
throw new \RuntimeException('Expected error');
}
}
```

What to note:
- Use the `#[Test]` attribute to mark test methods or classes
- Test classes don't need to extend any base class
- Use `Assert` class for assertions (`same`, `true`, `false`, `null`, `contains`, `instanceOf`, etc.)
- Testo provides multiple attributes to extend testing capabilities (retry policies, exception handling, and more)

## IDE Support

Testo comes with the [IDEA plugin `Testo`](https://plugins.jetbrains.com/plugin/28842-testo?noRedirect=true).

[![Version](https://img.shields.io/jetbrains/plugin/v/28842-testo?style=flat-square)](https://plugins.jetbrains.com/plugin/28842-testo/versions)
[![Rating](https://img.shields.io/jetbrains/plugin/r/rating/28842-testo?style=flat-square)](https://plugins.jetbrains.com/plugin/28842-testo/reviews)
[![Downloads](https://img.shields.io/jetbrains/plugin/d/28842-testo?style=flat-square)](https://plugins.jetbrains.com/plugin/28842-testo)