Skip to content

Commit 573ef6f

Browse files
committed
Add "Why Testo?" documentation
1 parent edf8dcf commit 573ef6f

3 files changed

Lines changed: 178 additions & 0 deletions

File tree

.vitepress/config.mts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ export default defineConfig({
2525
{
2626
text: 'Introduction',
2727
items: [
28+
{ text: 'Why Testo?', link: '/docs/why-testo' },
2829
{ text: 'Getting Started', link: '/docs/getting-started' },
2930
],
3031
},
@@ -60,6 +61,7 @@ export default defineConfig({
6061
{
6162
text: 'Введение',
6263
items: [
64+
{ text: 'Почему Testo?', link: '/ru/docs/why-testo' },
6365
{ text: 'Начало работы', link: '/ru/docs/getting-started' },
6466
],
6567
},

docs/why-testo.md

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
# Why Testo?
2+
3+
Testo (pronounced [test-oh], meaning "dough" in many languages) is an extensible testing framework for PHP. Built for scenarios requiring complete customization of the testing process: SDKs, framework tools, complex integrations.
4+
5+
Unlike other testing frameworks, Testo provides everything at once: familiar and convenient PHP syntax, unprecedented extensibility and customizability, and a simple yet powerful architecture based on a minimal core and middleware system.
6+
7+
You can mold it into any testing infrastructure you need.
8+
9+
## History
10+
11+
Testo was born from the need for an extensible testing framework that could adapt to the complex requirements of modern PHP projects. In brief:
12+
13+
- Previously, to wrap test execution with custom logic, we relied on overriding the `TestCase::runTest()` method, which, although marked with `@internal` annotation, had existed for many years without semantic changes. It was a perfect extension point.
14+
- However, in versions [10.5.46](https://github.com/sebastianbergmann/phpunit/commit/8f0f8205e3a38675392da55afc573c6bb6a43f4e), [11](https://github.com/sebastianbergmann/phpunit/issues/5254), and 12, this method became `private`.
15+
- Appeals to maintainers [don't work](https://github.com/sebastianbergmann/phpunit/issues/6389). [Even these ones](https://github.com/sebastianbergmann/phpunit/issues/6381).
16+
- PEST also faced this problem. What did they do? Simply [overrode some PHPUnit classes in their own namespace](https://github.com/pestphp/pest/tree/bc57a84e77afd4544ff9643a6858f68d05aeab96/overrides). But this is a fragile solution, so PEST additionally [set conflicts in composer.json](https://github.com/pestphp/pest/blob/bc57a84e77afd4544ff9643a6858f68d05aeab96/composer.json#L33) to prevent breaking PHPUnit updates.
17+
18+
## Testo Philosophy
19+
20+
### Developer's Full Control
21+
22+
From Testo's perspective, **tests are the developer's property, not the framework's**. All metadata and operational data needed by the framework are stored and processed separately.
23+
24+
Therefore:
25+
- Test classes **don't need to extend** `TestCase`
26+
- Test cases don't run themselves and don't even know their name in the test environment
27+
- You can use the constructor however you want
28+
- Tests can even be ordinary functions!
29+
30+
```php
31+
#[Test]
32+
function simpleTest(): void
33+
{
34+
Assert::true(true);
35+
}
36+
```
37+
38+
### Extensibility
39+
40+
Testo is built on a simple idea: **a small core with a set of DTOs and contracts, and all functionality is built on top of middleware and event system**.
41+
42+
The core simply builds several pipelines from middleware, and then do whatever you want. Every framework feature is middleware or event handlers:
43+
- Attributes in general
44+
- Data providers
45+
- Inline testing
46+
- Assertion system (`Assert`, `Expect`)
47+
- CLI rendering and TeamCity
48+
49+
### Well-Designed API
50+
51+
Instead of a bloated `Assert` facade with ~2300 lines (as in PHPUnit), Testo provides:
52+
- **`Assert`** — for assertions (checked here and now)
53+
- **`Expect`** — for expectations (checked after test completion)
54+
- **Pipe assertions** — grouping by types for cleaner code:
55+
56+
```php
57+
// Strings
58+
Assert::string($string)->contains("str");
59+
60+
// Files
61+
Assert::file("foo.txt")->notExists();
62+
63+
// Exceptions
64+
Expect::exception(Failure::class)
65+
->fromMethod(Service::class, 'process')
66+
->withMessage("foo bar");
67+
```
68+
69+
Testo comes with a [PhpStorm/IntelliJ IDEA plugin](https://plugins.jetbrains.com/plugin/28842-testo) that provides all the familiar functionality including test running, navigation, and debugging.
70+
71+
## Who Is Testo For?
72+
73+
Testo is built for those who:
74+
- Develop **frameworks** and need deep test integration.
75+
- Create **SDKs** with specific testing requirements.
76+
- Build **complex systems** where PHPUnit doesn't provide the needed flexibility.
77+
- Want **full control** over testing infrastructure.
78+
- Prefer PHP syntax over JS.
79+
80+
## What's Next?
81+
82+
Testo is in active development and moving toward version 1.0.0. We're open to ideas and suggestions from the community.
83+
84+
Join the development on [GitHub](https://github.com/php-testo/testo).
85+
86+
---
87+
88+
> We believe developers should have full control over their testing environment, and Testo delivers exactly that.

ru/docs/why-testo.md

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
# Почему Testo?
2+
3+
Testo (произносится [тесто], что означает «тесто» во многих языках) — расширяемый фреймворк тестирования для PHP. Создан для сценариев, требующих полной кастомизации процесса тестирования: SDK, инструменты фреймворков, сложные интеграции.
4+
5+
В отличие от других фреймворков тестирования, Testo предоставляет всё сразу: привычный и удобный PHP-синтаксис, беспрецедентную расширяемость и кастомизируемость, а также простую, но мощную архитектуру на основе минимального ядра и системы middleware.
6+
7+
Вы можете слепить из него любую инфраструктуру тестирования, которая вам нужна.
8+
9+
## История создания
10+
11+
Testo родился из потребности в расширяемом фреймворке тестирования, который мог бы адаптироваться к сложным требованиям современных PHP-проектов. Подробнее о мотивации создания Testo [читайте здесь](https://www.notion.so/PHPUnit-28a5a7ab4c6c80c18d64f562da4aeca4), но вкратце:
12+
13+
- Раньше, чтобы обернуть запуск теста своей логикой, мы опирались на переопределение метода `TestCase::runTest()`, который хоть и был помечен аннотацией `@internal`, но многие годы существовал и семантически не менялся. Это была прекрасная точка для расширения.
14+
- Однако, в версиях [10.5.46](https://github.com/sebastianbergmann/phpunit/commit/8f0f8205e3a38675392da55afc573c6bb6a43f4e), [11](https://github.com/sebastianbergmann/phpunit/issues/5254) и 12 этот метод стал `private`.
15+
- Обращения к автору PHPUnit [не работают](https://github.com/sebastianbergmann/phpunit/issues/6389). [Даже такие](https://github.com/sebastianbergmann/phpunit/issues/6381).
16+
- В PEST тоже столкнулись с этой проблемой. Что они сделали? Просто [переопределил некоторые классы PHPUnit в своём неймспейсе](https://github.com/pestphp/pest/tree/bc57a84e77afd4544ff9643a6858f68d05aeab96/overrides). Но это хрупкое решение, поэтому в PEST дополнительно [выставлены конфликты в composer.json](https://github.com/pestphp/pest/blob/bc57a84e77afd4544ff9643a6858f68d05aeab96/composer.json#L33), чтобы не допустить ломающего обновления PHPUnit.
17+
18+
## Философия Testo
19+
20+
### Полный контроль разработчика
21+
22+
С позиции Testo, **тесты — это владение разработчика, а не фреймворка**. Вся метаинформация и оперативные данные, нужные фреймворку, хранятся и обрабатываются в стороне.
23+
24+
Поэтому:
25+
- Тестовым классам **не нужно наследоваться** от `TestCase`
26+
- Тест-кейс не запускает сам себя и даже не знает своё имя в тестовой среде
27+
- Вы можете использовать конструктор как угодно
28+
- Тестами могут быть даже обычные функции!
29+
30+
```php
31+
#[Test]
32+
function simpleTest(): void
33+
{
34+
Assert::true(true);
35+
}
36+
```
37+
38+
### Расширяемость
39+
40+
Testo построен на простой идее: **небольшое ядро с набором DTO и контрактов, а весь функционал выстраивается на базе middleware и системы событий**.
41+
42+
Ядро просто выстраивает несколько pipelines из middleware, а дальше делай что хочешь. Любая фича фреймворка это middleware или бработчики событий:
43+
- Атрибуты в целом
44+
- Дата-провайдеры
45+
- Inline-тестирование
46+
- Система утверждений (`Assert`, `Expect`)
47+
- CLI рендеринг и TeamCity
48+
49+
### Продуманное API
50+
51+
Вместо раздутого фасада `Assert` на ~2300 строк (как в PHPUnit), Testo предоставляет:
52+
- **`Assert`** — для утверждений (проверяются здесь и сейчас)
53+
- **`Expect`** — для ожиданий (проверяются после завершения теста)
54+
- **Пайповые ассерты** — группировка по типам для чистоты кода:
55+
56+
```php
57+
// Строки
58+
Assert::string($string)->contains("str");
59+
60+
// Файлы
61+
Assert::file("foo.txt")->notExists();
62+
63+
// Исключения
64+
Expect::exception(Failure::class)
65+
->fromMethod(Service::class, 'process')
66+
->withMessage("foo bar");
67+
```
68+
69+
Testo поставляется с [плагином для PhpStorm/IntelliJ IDEA](https://plugins.jetbrains.com/plugin/28842-testo), в котором есть весь привычный функционал с запуском тестов, навигацией и отладкой.
70+
71+
## Для кого Testo?
72+
73+
Testo создан для тех, кто:
74+
- Разрабатывает **фреймворки** и нуждается в глубокой интеграции тестов.
75+
- Создаёт **SDK** со специфичными требованиями к тестированию.
76+
- Строит **сложные системы**, где PHPUnit не даёт нужной гибкости.
77+
- Хочет **полного контроля** над тестовой инфраструктурой.
78+
- Предпочитает синтаксис PHP, а не JS.
79+
80+
## Что дальше?
81+
82+
Testo находится в активной разработке и движется к версии 1.0.0. Мы открыты для идей и предложений от сообщества.
83+
84+
Присоединяйтесь к обсуждению в [Telegram](https://t.me/spiralphp) или участвуйте в разработке на [GitHub](https://github.com/php-testo/testo).
85+
86+
---
87+
88+
> Мы верим, что разработчики должны иметь полный контроль над своей тестовой средой, и Testo предоставляет именно это.

0 commit comments

Comments
 (0)