@@ -94,6 +94,27 @@ class UserTest extends PHPUnit\Framework\TestCase {
9494}
9595```
9696
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+ ```
97118
98119## Purpose
99120
@@ -215,7 +236,7 @@ public function someData()
215236
216237## Before/After
217238
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.
219240
220241``` php
221242<?php
@@ -250,11 +271,18 @@ Install with Composer:
250271"require-dev" : {
251272 "codeception/specify" : " *" ,
252273 "codeception/verify" : " *"
253-
254274}
255275```
256276Include ` Codeception\Specify ` trait into ` PHPUnit\Framework\TestCase ` .
257277
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+
258286## Recommended
259287
260288* Use [ Codeception/AssertThrows] ( https://github.com/Codeception/AssertThrows ) for exception assertions
0 commit comments