33namespace Codeception \Module ;
44
55use Codeception \Module ;
6+ use Codeception \TestInterface ;
67use Drupal \Core \Config \StorageInterface ;
78use Drupal \Core \Entity \EntityStorageInterface ;
89use Drupal \user \Entity \User ;
910use Faker \Factory ;
1011use Codeception \Util \Drush ;
12+ use Exception ;
1113
1214/**
1315 * Class DrupalUser.
1618 * #### Example (DrupalUser)
1719 * modules:
1820 * - DrupalUser:
19- * default_role: 'authenticated'
20- * driver: 'PhpBrowser'
21- * drush: './vendor/bin/drush'
22- * cleanup_entities:
23- * - media
24- * - file
25- * - paragraph
26- * cleanup_test: false
27- * cleanup_failed: false
28- * cleanup_suite: true
29- * alias: @site.com
21+ * default_role: 'authenticated'
22+ * driver: 'PhpBrowser'
23+ * drush: './vendor/bin/drush'
24+ * cleanup_entities:
25+ * - media
26+ * - file
27+ * - paragraph
28+ * cleanup_test: false
29+ * cleanup_failed: false
30+ * cleanup_suite: true
31+ * alias: @site.com
3032 *
3133 * @package Codeception\Module
3234 */
@@ -51,7 +53,7 @@ class DrupalUser extends Module {
5153 *
5254 * @var array
5355 */
54- protected $ config = [
56+ protected array $ config = [
5557 'alias ' => '' ,
5658 'default_role ' => 'authenticated ' ,
5759 'driver ' => 'WebDriver ' ,
@@ -65,7 +67,7 @@ class DrupalUser extends Module {
6567 /**
6668 * {@inheritdoc}
6769 */
68- public function _beforeSuite ($ settings = []) { // @codingStandardsIgnoreLine
70+ public function _beforeSuite (array $ settings = []) { // @codingStandardsIgnoreLine
6971 $ this ->driver = null ;
7072 if (!$ this ->hasModule ($ this ->_getConfig ('driver ' ))) {
7173 $ this ->fail ('User driver module not found. ' );
@@ -77,7 +79,7 @@ public function _beforeSuite($settings = []) { // @codingStandardsIgnoreLine
7779 /**
7880 * {@inheritdoc}
7981 */
80- public function _after (\ Codeception \ TestCase $ test ) { // @codingStandardsIgnoreLine
82+ public function _after (TestInterface $ test ) { // @codingStandardsIgnoreLine
8183 if ($ this ->_getConfig ('cleanup_test ' )) {
8284 $ this ->userCleanup ();
8385 }
@@ -86,7 +88,7 @@ public function _after(\Codeception\TestCase $test) { // @codingStandardsIgnoreL
8688 /**
8789 * {@inheritdoc}
8890 */
89- public function _failed (\ Codeception \ TestCase $ test , $ fail ) { // @codingStandardsIgnoreLine
91+ public function _failed (TestInterface $ test , Exception $ fail ) { // @codingStandardsIgnoreLine
9092 if ($ this ->_getConfig ('cleanup_failed ' )) {
9193 $ this ->userCleanup ();
9294 }
0 commit comments