@@ -36,7 +36,7 @@ This module uses Symfony Crawler and HttpKernel to emulate requests and test res
36
36
37
37
### Demo Project
38
38
39
- < https://github.com/Codeception/symfony-demo >
39
+ < https://github.com/Codeception/symfony-module-tests >
40
40
41
41
### Config
42
42
@@ -542,6 +542,21 @@ Checks that no email was sent. This is an alias for seeEmailIsSent(0).
542
542
* ` [Part] ` email
543
543
544
544
545
+ #### dontSeeEventTriggered
546
+
547
+ Make sure events did not fire during the test.
548
+
549
+ {% highlight php %}
550
+
551
+ <? php
552
+ $I-> dontSeeEventTriggered('App\MyEvent');
553
+ $I->dontSeeEventTriggered(new App\Events\MyEvent());
554
+ $I->dontSeeEventTriggered(['App\MyEvent', 'App\MyOtherEvent']);
555
+
556
+ {% endhighlight %}
557
+ * `param string|object|string[]` $expected
558
+
559
+
545
560
#### dontSeeFormErrors
546
561
547
562
Verifies that there are no errors bound to the submitted form.
@@ -1310,6 +1325,57 @@ $I->seeFormErrorMessage('username', 'Username is empty');
1310
1325
* `param string|null` $message
1311
1326
1312
1327
1328
+ #### seeFormErrorMessages
1329
+
1330
+ Verifies that multiple fields on a form have errors.
1331
+
1332
+ If you only specify the name of the fields, this method will
1333
+ verify that the field contains at least one error of any type:
1334
+
1335
+ {% highlight php %}
1336
+
1337
+ <? php
1338
+ $I-> seeFormErrorMessages(['telephone', 'address']);
1339
+
1340
+ {% endhighlight %}
1341
+
1342
+ If you want to specify the error messages, you can do so
1343
+ by sending an associative array instead, with the key being
1344
+ the name of the field and the error message the value.
1345
+
1346
+ This method will validate that the expected error message
1347
+ is contained in the actual error message, that is,
1348
+ you can specify either the entire error message or just a part of it:
1349
+
1350
+ {% highlight php %}
1351
+
1352
+ <? php
1353
+ $I-> seeFormErrorMessages([
1354
+ 'address' => 'The address is too long'
1355
+ 'telephone' => 'too short', // the full error message is 'The telephone is too short'
1356
+ ]);
1357
+
1358
+ {% endhighlight %}
1359
+
1360
+ If you don't want to specify the error message for some fields,
1361
+ you can pass `null` as value instead of the message string,
1362
+ or you can directly omit the value of that field. If that is the case,
1363
+ it will be validated that that field has at least one error of any type:
1364
+
1365
+ {% highlight php %}
1366
+
1367
+ <? php
1368
+ $I-> seeFormErrorMessages([
1369
+ 'telephone' => 'too short',
1370
+ 'address' => null,
1371
+ 'postal code',
1372
+ ]);
1373
+
1374
+ {% endhighlight %}
1375
+
1376
+ * `param string[]` $expectedErrors
1377
+
1378
+
1313
1379
#### seeFormHasErrors
1314
1380
1315
1381
Verifies that there are one or more errors bound to the submitted form.
@@ -1455,12 +1521,12 @@ Assert that a session attribute exists.
1455
1521
{% highlight php %}
1456
1522
1457
1523
<? php
1458
- $I-> seeInSession('attrib ');
1459
- $I->seeInSession('attrib ', 'value');
1524
+ $I-> seeInSession('attribute ');
1525
+ $I->seeInSession('attribute ', 'value');
1460
1526
1461
1527
{% endhighlight %}
1462
1528
1463
- * `param string` $attrib
1529
+ * `param string` $attribute
1464
1530
* `param mixed|null` $value
1465
1531
1466
1532
@@ -1684,6 +1750,20 @@ $I->seeUserHasRole('ROLE_ADMIN');
1684
1750
* `param string` $role
1685
1751
1686
1752
1753
+ #### seeUserHasRoles
1754
+
1755
+ Verifies that the current user has multiple roles
1756
+
1757
+ {% highlight php %}
1758
+
1759
+ <? php
1760
+ $I-> seeUserHasRoles(['ROLE_USER', 'ROLE_ADMIN']);
1761
+
1762
+ {% endhighlight %}
1763
+
1764
+ * `param string[]` $roles
1765
+
1766
+
1687
1767
#### seeUserPasswordDoesNotNeedRehash
1688
1768
1689
1769
Checks that the user's password would not benefit from rehashing.
0 commit comments