You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: blog/assert-and-expect.md
+4-8Lines changed: 4 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -20,8 +20,7 @@ assertTrue(...);
20
20
21
21
All these calls lead to one place — the `Assert` facade with ~2300 lines.
22
22
23
-
::: info 🤔
24
-
Did you know that PHPUnit has neither a standalone `expectException()` function nor a method with the same name in the `Assert` facade?
23
+
::: info 🤔 Did you know that PHPUnit has neither a standalone `expectException()` function nor a method with the same name in the `Assert` facade?
25
24
In test code, you can only write `$this->expectException()`.
26
25
:::
27
26
@@ -48,8 +47,7 @@ function simpleTest(): void
48
47
}
49
48
```
50
49
51
-
::: tip 🧠
52
-
But now we face a tricky question with lots of room for imagination: **how do we provide a convenient API for assertions?**
50
+
::: tip 🧠 But now we face a tricky question with lots of room for imagination: **how do we provide a convenient API for assertions?**
53
51
:::
54
52
55
53
Sure, we could eventually create a hundred functions, a trait, and a base class with PHPUnit-like syntax... But hey, let's try to find something better first!
This led us to a strategic decision: provide only "complex" assertions that save characters or entire lines of code.
83
+
::: warning ☝ This led us to a strategic decision: provide only "complex" assertions that save characters or entire lines of code.
87
84
:::
88
85
89
86
---
@@ -171,8 +168,7 @@ We're also trying out how it would look in an IDE. Will this be useful?
171
168
172
169
There's also an option to output each assertion as a nested checkmark in the test tree (like DataSet), but I think that would be too cluttered.
173
170
174
-
::: tip ☝
175
-
It might seem like there are only more open questions. But over time, not only questions appear, but expertise grows too: each answer to a closed question is backed by mental or practical experience.
171
+
::: tip ☝ It might seem like there are only more open questions. But over time, not only questions appear, but expertise grows too: each answer to a closed question is backed by mental or practical experience.
176
172
:::
177
173
178
174
The final word on assert/expect hasn't been said. But while Testo hasn't reached a stable release, we can afford any experiments.
description: "Your support is Testo's key ingredient"
5
+
image: /blog/ty/img-0.jpg
6
+
author: Aleksei Gagarin
7
+
---
8
+
9
+
# TY
10
+
11
+
I started creating Testo for myself because no existing testing framework could meet my needs.
12
+
13
+
However, after I talked about it at a PHP Random Beer meetup, I realized that the upcoming Testo features resonated with my fellow drinkers, and that I wasn't the only one with complaints about existing frameworks.
14
+
15
+

16
+
17
+
Then the information about Testo [leaked to a local "plausible" news outlet](https://t.me/php_fart/282) and others started learning about the project. That same day, my first sponsor reached out.
18
+
19
+
::: danger 💥 I saw the demand and I felt the support. This changed my attitude towards the project.
20
+
:::
21
+
22
+
What I thought would be "thrown together in a few evenings" at the start turned into something bigger: today Testo is a **full-fledged testing framework** with a well-thought-out architecture, its own assertion system, and even its own IDE plugin. Who would have thought it would take off like this?
23
+
24
+
Now, with the launch of the landing page and documentation, I see your stars coming into [Testo's Github](https://github.com/php-testo/testo): you see the project's vision and you support it.
Copy file name to clipboardExpand all lines: ru/blog/assert-and-expect.md
+5-9Lines changed: 5 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -20,9 +20,8 @@ assertTrue(...);
20
20
21
21
Все эти вызовы ведут в одно место — в фасад `Assert` на ~2300 строк.
22
22
23
-
::: info 🤔
24
-
Но знаете ли вы, что в PHPUnit нет ни отдельной функции `expectException()`, ни одноимённого метода в фасаде `Assert`?
25
-
В коде теста можно написать только `$this->expectException()`.
23
+
::: info 🤔 Но знаете ли вы, что в PHPUnit нет ни отдельной функции `expectException()`, ни одноимённого метода в фасаде `Assert`?
24
+
В тесте можно написать только `$this->expectException()`.
26
25
:::
27
26
28
27
Это потому, что в PHPUnit тесты наследуются от `TestCase` (~2400 строк, расширяет `Assert`), в котором хранится и обрабатывается всё состояние теста. Мне это напоминает архитектуру Symfony Console, хуже которой я пока не встречал.
@@ -48,8 +47,7 @@ function simpleTest(): void
48
47
}
49
48
```
50
49
51
-
::: tip 🧠
52
-
Но теперь возникает непростой вопрос с очень широким простором для фантазии: **как предоставить удобное API для проверок?**
50
+
::: tip 🧠 Но теперь возникает непростой вопрос с очень широким простором для фантазии: **как предоставить удобное API для проверок?**
53
51
:::
54
52
55
53
Да, мы можем в будущем сделать сотню функций, трейт и базовый класс с синтаксисом как у PHPUnit... Но эй, давайте сначала попробуем нащупать что-то получше!
Это привело нас к стратегическому решению: предоставлять только "сложные" проверки, которые экономят знаки или целые строки кода.
82
+
::: warning ☝ Это привело нас к стратегическому решению: предоставлять только "сложные" проверки, которые экономят знаки или целые строки кода.
86
83
:::
87
84
88
85
---
@@ -172,8 +169,7 @@ public function checkIterableTraitMethods(): void
172
169
173
170
Есть ещё вариант выводить каждый ассерт как вложенная галочка в дереве тестов (как DataSet), но думаю, это будет сильно перегружено.
174
171
175
-
::: tip ☝
176
-
Может показаться, что открытых вопросов становится только больше. Но со временем появляются не только вопросы, но также растёт экспертиза: каждый ответ на закрытый вопрос подкреплён ментальными или практическими опытами.
172
+
::: tip ☝ Может показаться, что открытых вопросов становится только больше. Но со временем появляются не только вопросы, но также растёт экспертиза: каждый ответ на закрытый вопрос подкреплён ментальными или практическими опытами.
177
173
:::
178
174
179
175
Точка в assert/expect не поставлена. Но пока Testo не релизнулся в стабильный тег, мы можем позволить себе любые эксперименты.
description: "Ваша поддержка — важнейший ингредиент Testo"
5
+
image: /blog/ty/img-0.jpg
6
+
author: Алексей Гагарин
7
+
---
8
+
9
+
# СПС
10
+
11
+
Я начал создавать Testo для себя, поскольку ни одни существующий фреймворк тестирования не мог закрыть мои потребности.
12
+
13
+
Однако, после того, как я рассказал об этом на встрече PHP Random Beer, я понял, что будущие фичи Testo отзываются в сердцах собутыльников, да и в целом не только у меня одного есть претензии к существующим фреймворкам.
14
+
15
+

16
+
17
+
Затем информация про Testo [утекла в Пыхораму](https://t.me/php_fart/282) и о проекте начали узнавать остальные. В этот же день ко мне постучался первый спонсор.
18
+
19
+
::: danger 💥 Я увидел потребность и я почувствовал поддержку. Это изменило моё отношение к проекту.
20
+
:::
21
+
22
+
То, что я думал “накидаю за несколько вечеров” на старте, превратилось в нечто большее: сегодня Testo — это **полноценный фреймворк тестирования** с продуманной архитектурой, самостоятельной системой проверок и даже со своим плагином для IDE. Кто бы мог подумать, что оно так попрёт?
23
+
24
+
Теперь, с запуском лендинга и документации, я вижу, что в [Github Testo](https://github.com/php-testo/testo) стали залетать ваши звёзды: вы видите идею проекта и вы её поддерживаете.
0 commit comments