@@ -94,6 +94,27 @@ class UserTest extends PHPUnit\Framework\TestCase {
94
94
}
95
95
```
96
96
97
+ ### Specify + Verify Example
98
+
99
+ Use [ Codeception/Verify] (https://github.com/Codeception/Verify for simpler assertions:
100
+
101
+ ``` php
102
+ <?php
103
+ $this->specify("username is required", function() {
104
+ $this->user->username = null;
105
+ expect_not($this->user->validate(['username']));
106
+ });
107
+
108
+ $this->specify("username is too long", function() {
109
+ $this->user->username = 'toolooooongnaaaaaaameeee';
110
+ expect_not($this->user->validate(['username']));
111
+ });
112
+
113
+ $this->specify("username is ok", function() {
114
+ $this->user->username = 'davert';
115
+ expect_that($this->user->validate(['username']));
116
+ });
117
+ ```
97
118
98
119
## Purpose
99
120
@@ -215,7 +236,7 @@ public function someData()
215
236
216
237
## Before/After
217
238
218
- There are also before and after callbacks, which act as setUp/tearDown but only for specify.
239
+ There are also before and after callbacks, which act as setUp/tearDown but for specify.
219
240
220
241
``` php
221
242
<?php
@@ -250,11 +271,18 @@ Install with Composer:
250
271
"require-dev" : {
251
272
"codeception/specify" : " *" ,
252
273
"codeception/verify" : " *"
253
-
254
274
}
255
275
```
256
276
Include ` Codeception\Specify ` trait into ` PHPUnit\Framework\TestCase ` .
257
277
278
+ For PHPUnit add ` Codeception\Specify\ResultPrinter ` printer into ` phpunit.xml `
279
+
280
+
281
+ ``` xml
282
+ <phpunit colors =" true" printerClass =" Codeception\Specify\ResultPrinter" >
283
+ </phpunit >
284
+ ```
285
+
258
286
## Recommended
259
287
260
288
* Use [ Codeception/AssertThrows] ( https://github.com/Codeception/AssertThrows ) for exception assertions
0 commit comments