File tree Expand file tree Collapse file tree 5 files changed +60
-4
lines changed
Expand file tree Collapse file tree 5 files changed +60
-4
lines changed Original file line number Diff line number Diff line change @@ -53,6 +53,7 @@ export default defineConfig({
5353 link : '/docs/writing-tests' ,
5454 items : [
5555 { text : 'Test Attribute' , link : '/docs/test-attribute' } ,
56+ { text : 'Naming Conventions' , link : '/docs/naming-conventions' } ,
5657 { text : 'Inline Tests' , link : '/docs/inline-tests' } ,
5758 ] ,
5859 } ,
@@ -104,6 +105,7 @@ export default defineConfig({
104105 link : '/ru/docs/writing-tests' ,
105106 items : [
106107 { text : 'Атрибут Test' , link : '/ru/docs/test-attribute' } ,
108+ { text : 'Конвенции именования' , link : '/ru/docs/naming-conventions' } ,
107109 { text : 'Встроенные тесты' , link : '/ru/docs/inline-tests' } ,
108110 ] ,
109111 } ,
Original file line number Diff line number Diff line change 1+ # Naming Conventions
2+
3+ Testo can discover tests by naming patterns — no attributes required.
4+
5+ Recognized patterns:
6+
7+ - ** Class + Method** — ` *Test ` suffix on class and ` test* ` prefix on methods
8+ - ** Function** — ` test* ` prefix on function
9+
10+ ``` php
11+ final class UserServiceTest
12+ {
13+ public function testCreatesUser(): void { /* ... */ }
14+
15+ public function testDeletesUser(): void { /* ... */ }
16+
17+ public function testUpdatesProfile(): void { /* ... */ }
18+ }
19+
20+ function testEmailValidator(): void { /* ... */ }
21+ ```
22+
23+ ## When to Use
24+
25+ Use naming conventions when:
26+
27+ - You prefer ** implicit** test discovery without extra attributes
28+ - You're migrating from PHPUnit or other frameworks that use similar patterns
29+ - You want tests to be recognizable at a glance by their names
Original file line number Diff line number Diff line change @@ -39,5 +39,3 @@ Use `#[Test]` when:
3939- You want ** explicit** test declaration without relying on naming patterns
4040- Your method/function name doesn't follow the ` test ` prefix convention
4141- You prefer attribute-based discovery over convention-based
42-
43- The attribute can be combined with [ naming conventions] ( ./naming-conventions ) in the same project.
Original file line number Diff line number Diff line change 1+ # Конвенции именования
2+
3+ Testo может находить тесты по паттернам именования — атрибуты не нужны.
4+
5+ Распознаваемые паттерны:
6+
7+ - ** Класс + Метод** — суффикс ` *Test ` на классе и префикс ` test* ` на методах
8+ - ** Функция** — префикс ` test* ` на функции
9+
10+ ``` php
11+ final class UserServiceTest
12+ {
13+ public function testCreatesUser(): void { /* ... */ }
14+
15+ public function testDeletesUser(): void { /* ... */ }
16+
17+ public function testUpdatesProfile(): void { /* ... */ }
18+ }
19+
20+ function testEmailValidator(): void { /* ... */ }
21+ ```
22+
23+ ## Когда использовать
24+
25+ Используйте конвенции именования, когда:
26+
27+ - Предпочитаете ** неявное** обнаружение тестов без дополнительных атрибутов
28+ - Мигрируете с PHPUnit или других фреймворков с похожими паттернами
29+ - Хотите, чтобы тесты были узнаваемы по именам с первого взгляда
Original file line number Diff line number Diff line change @@ -39,5 +39,3 @@ function checks_environment(): void { /* ... */ }
3939- Хотите ** явно** объявлять тесты без привязки к именам
4040- Имя метода/функции не следует конвенции с префиксом ` test `
4141- Предпочитаете обнаружение по атрибутам, а не по конвенциям
42-
43- Атрибут можно комбинировать с [ конвенциями именования] ( ./naming-conventions ) в одном проекте.
You can’t perform that action at this time.
0 commit comments