1111 * you can use generated unique names, that should not conflict.
1212 * When you create article on a site, for instance, you can assign it a unique name and then check it.
1313 *
14- * This module has no actions, but introduces a function `sq` for generating unique sequences.
14+ * This module has no actions, but introduces a function `sq` for generating unique sequences within test and
15+ * `sqs` for generating unique sequences across suite.
1516 *
1617 * ### Usage
1718 *
5051 * ?>
5152 * ```
5253 *
54+ * Cest Suite tests:
55+ *
56+ * ``` php
57+ * <?php
58+ * class UserTest
59+ * {
60+ * public function createUser(AcceptanceTester $I)
61+ * {
62+ * $I->createUser('email' . sqs('user') . '@mailserver.com', sqs('login'), sqs('pwd'));
63+ * }
64+ *
65+ * public function checkEmail(AcceptanceTester $I)
66+ * {
67+ * $I->seeInEmailTo('email' . sqs('user') . '@mailserver.com', sqs('login'));
68+ * }
69+ *
70+ * public function removeUser(AcceptanceTester $I)
71+ * {
72+ * $I->removeUser('email' . sqs('user') . '@mailserver.com');
73+ * }
74+ * }
75+ * ?>
76+ * ```
5377 */
5478class Sequence extends CodeceptionModule
5579{
56- public static $ hash = array ();
80+ public static $ hash = [];
81+ public static $ suiteHash = [];
5782
5883 public function _after (TestCase $ t )
5984 {
6085 self ::$ hash = [];
6186 }
87+
88+ public function _afterSuite ()
89+ {
90+ self ::$ suiteHash = [];
91+ }
6292}
6393
64- if (!function_exists ('sq ' )) {
94+ if (!function_exists ('sq ' ) && ! function_exists ( ' sqs ' ) ) {
6595 require_once __DIR__ . '/../Util/sq.php ' ;
96+ require_once __DIR__ . '/../Util/sqs.php ' ;
6697} else {
67- throw new ModuleException ('Codeception\Module\Sequence ' , "function 'sq' already defined " );
98+ throw new ModuleException ('Codeception\Module\Sequence ' , "function 'sq' and 'sqs' already defined " );
6899}
0 commit comments