$ phpcs --standard=Drupal --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml redirect_after_logout/

FILE: ...ion\web\modules\contrib\redirect_after_logout\redirect_after_logout.module
--------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------
21 | ERROR | [x] Case breaking statement indented incorrectly; expected 6
| | spaces, found 5
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------

FILE: ...edirect_after_logout\src\EventSubscriber\RedirectAfterLogoutSubscriber.php
--------------------------------------------------------------------------------
FOUND 2 ERRORS AND 1 WARNING AFFECTING 3 LINES
--------------------------------------------------------------------------------
10 | WARNING | [x] Unused use statement
41 | ERROR | [ ] Expected type hint "ResponseEvent"; found
| | "FilterResponseEvent" for $event
44 | ERROR | [x] A unary operator statement must not be followed by a space
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------

FILE: ...\modules\contrib\redirect_after_logout\src\Form\RedirectLogoutSettings.php
--------------------------------------------------------------------------------
FOUND 3 ERRORS AND 2 WARNINGS AFFECTING 5 LINES
--------------------------------------------------------------------------------
21 | WARNING | [ ] The class short comment should describe what the class
| | does and not simply repeat the class name
47 | ERROR | [ ] Missing @var tag in member variable comment
160 | WARNING | [ ] Line exceeds 80 characters; contains 97 characters
191 | ERROR | [x] Expected 1 blank line after function; 0 found
192 | ERROR | [x] The closing brace for the class must have an empty line
| | before it
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------

FILE: ...odules\contrib\redirect_after_logout\tests\src\Functional\SettingsTest.php
--------------------------------------------------------------------------------
FOUND 4 ERRORS AFFECTING 4 LINES
--------------------------------------------------------------------------------
16 | ERROR | [ ] Missing member variable doc comment
141 | ERROR | [x] Inline comments must end in full-stops, exclamation marks,
| | question marks, colons, or closing parentheses
147 | ERROR | [x] Expected 1 blank line after function; 0 found
148 | ERROR | [x] The closing brace for the class must have an empty line
| | before it
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------

FILE: ...s\contrib\redirect_after_logout\tests\src\Functional\SettingsTestToken.php
--------------------------------------------------------------------------------
FOUND 3 ERRORS AFFECTING 3 LINES
--------------------------------------------------------------------------------
12 | ERROR | [ ] Missing member variable doc comment
29 | ERROR | [x] Expected 1 blank line after function; 0 found
30 | ERROR | [x] The closing brace for the class must have an empty line
| | before it
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------

FILE: ...es\contrib\redirect_after_logout\tests\src\Functional\SimpleLogoutTest.php
--------------------------------------------------------------------------------
FOUND 9 ERRORS AFFECTING 6 LINES
--------------------------------------------------------------------------------
12 | ERROR | [ ] Missing member variable doc comment
26 | ERROR | [x] Inline comments must start with a capital letter
26 | ERROR | [x] Inline comments must end in full-stops, exclamation marks,
| | question marks, colons, or closing parentheses
34 | ERROR | [x] Inline comments must start with a capital letter
34 | ERROR | [x] Inline comments must end in full-stops, exclamation marks,
| | question marks, colons, or closing parentheses
42 | ERROR | [x] Inline comments must start with a capital letter
42 | ERROR | [x] Inline comments must end in full-stops, exclamation marks,
| | question marks, colons, or closing parentheses
48 | ERROR | [x] Expected 1 blank line after function; 0 found
49 | ERROR | [x] The closing brace for the class must have an empty line
| | before it
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 8 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------

FILE: ...eb\modules\contrib\redirect_after_logout\tests\src\Functional\TestBase.php
--------------------------------------------------------------------------------
FOUND 10 ERRORS AFFECTING 10 LINES
--------------------------------------------------------------------------------
11 | ERROR | [x] Doc comment short description must start with a capital
| | letter
27 | ERROR | [ ] Missing member variable doc comment
29 | ERROR | [ ] Missing short description in doc comment
32 | ERROR | [ ] Class property $admin_user should use lowerCamel naming
| | without underscores
34 | ERROR | [ ] Missing short description in doc comment
37 | ERROR | [ ] Class property $authenticated_user should use lowerCamel
| | naming without underscores
39 | ERROR | [ ] Missing short description in doc comment
42 | ERROR | [ ] Class property $regular_user should use lowerCamel naming
| | without underscores
72 | ERROR | [x] Expected 1 blank line after function; 0 found
73 | ERROR | [x] The closing brace for the class must have an empty line
| | before it
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------

FILE: ...les\contrib\redirect_after_logout\tests\src\Functional\TokenLogoutTest.php
--------------------------------------------------------------------------------
FOUND 3 ERRORS AFFECTING 3 LINES
--------------------------------------------------------------------------------
16 | ERROR | [ ] Missing member variable doc comment
45 | ERROR | [x] Expected 1 blank line after function; 0 found
46 | ERROR | [x] The closing brace for the class must have an empty line
| | before it
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------

Time: 387ms; Memory: 10MB

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

Rakhi Soni created an issue. See original summary.

rakhi soni’s picture

Assigned: rakhi soni » Unassigned
Status: Active » Needs review
StatusFileSize
new8.45 KB

I have created a patch to fix the issue of "Drupal Coding Standard",, please review.
Thanks & Regards
Rakhi Soni,,

shamir.vs’s picture

Status: Needs review » Needs work

Hi @rakhi-soni, There are a few more errors. can you please check

FILE: /home/shamir/Projects/drupal9/drupal-contributions-9.x/web/modules/contrib/redirect_after_logout/redirect_after_logout.module
------------------------------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 3 ERRORS AFFECTING 3 LINES
------------------------------------------------------------------------------------------------------------------------------------------------------------------------
21 | ERROR | [x] Case breaking statement indented incorrectly; expected 6 spaces, found 5
30 | ERROR | [ ] The $_GET super global must not be accessed directly; inject the request_stack service and use
| | $stack->getCurrentRequest()->query->get('logout-message') instead
36 | ERROR | [ ] The $_GET super global must not be accessed directly; inject the request_stack service and use
| | $stack->getCurrentRequest()->query->get('logout-message') instead
------------------------------------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------------------------------------------------------------------------------

FILE: /home/shamir/Projects/drupal9/drupal-contributions-9.x/web/modules/contrib/redirect_after_logout/redirect_after_logout.info.yml
-------------------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 3 WARNINGS AFFECTING 1 LINE
-------------------------------------------------------------------------------------------------------------------------------------
1 | WARNING | Remove "project" from the info file, it will be added by drupal.org packaging automatically
1 | WARNING | Remove "datestamp" from the info file, it will be added by drupal.org packaging automatically
1 | WARNING | Remove "version" from the info file, it will be added by drupal.org packaging automatically
-------------------------------------------------------------------------------------------------------------------------------------

FILE: /home/shamir/Projects/drupal9/drupal-contributions-9.x/web/modules/contrib/redirect_after_logout/src/Form/RedirectLogoutSettings.php
------------------------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
------------------------------------------------------------------------------------------------------------------------------------------
18 | WARNING | The class short comment should describe what the class does and not simply repeat the class name
------------------------------------------------------------------------------------------------------------------------------------------

FILE: /home/shamir/Projects/drupal9/drupal-contributions-9.x/web/modules/contrib/redirect_after_logout/src/EventSubscriber/RedirectAfterLogoutSubscriber.php
------------------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 2 ERRORS AND 1 WARNING AFFECTING 3 LINES
------------------------------------------------------------------------------------------------------------------------------------------------------------
10 | WARNING | [x] Unused use statement
41 | ERROR | [ ] Expected type hint "ResponseEvent"; found "FilterResponseEvent" for $event
43 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 5
------------------------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------------------------------------------------------------------

nitin_lama’s picture

StatusFileSize
new25.94 KB

Patch #2 applied cleanly. #3 @shamir.vs No fixable errors were found after applying the patch.

nitin_lama’s picture

Status: Needs work » Needs review
nevergone’s picture

Please wait, I will be there shortly.

nevergone’s picture

Status: Needs review » Needs work

The patch is #3293261-2: Drupal Coding Standard Issue As per 'phpcs --standard=Drupal' is wrong. Please fix it.

For example:

diff --git a/tests/src/Functional/TestBase.php b/tests/src/Functional/TestBase.php
index 50c0b81..b5d0324 100644
--- a/tests/src/Functional/TestBase.php
+++ b/tests/src/Functional/TestBase.php
@@ -29,17 +29,17 @@ abstract class TestBase extends BrowserTestBase {
   /**
    * @var \Drupal\user\Entity\User
    */
-  protected $admin_user;
+  protected $adminuser;
 
   /**
    * @var \Drupal\user\Entity\User
    */
-  protected $authenticated_user;
+  protected $authenticateduser;
 
   /**
    * @var \Drupal\user\Entity\User
    */
-  protected $regular_user;
+  protected $regularuser;

However:

$this->regular_user = $this->drupalCreateUser(['redirect user after logout']);

mrinalini9’s picture

Status: Needs work » Needs review
StatusFileSize
new11.48 KB
new5.57 KB

Updated patch #2 by addressing #7, please review it.

atul_ghate’s picture

Assigned: Unassigned » atul_ghate

Hi,
I will review this patch

nevergone’s picture

Status: Needs review » Needs work
diff --git a/tests/src/Functional/TestBase.php b/tests/src/Functional/TestBase.php
index 50c0b81..e97e028 100644
--- a/tests/src/Functional/TestBase.php
+++ b/tests/src/Functional/TestBase.php
@@ -27,9 +27,11 @@ abstract class TestBase extends BrowserTestBase {
   protected $defaultTheme = 'stable';
 
   /**
+   * A user with admin permissions.
+   *
    * @var \Drupal\user\Entity\User
    */
-  protected $admin_user;
+  protected $adminUser;

But tests/src/Functional/TestBase.php, line 58:

$this->admin_user = $this->drupalCreateUser(['administer site configuration']);

phpcs static analyzer is ok, but drupal-check:

Check deprecations: (-d)

www-data@cli-drupal9-test:/app$ drupal-check -d /app/web/modules/custom/redirect_after_logout/
 9/9 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%

 ------ ---------------------------------------------------------------- 
  Line   redirect_after_logout.module                                    
 ------ ---------------------------------------------------------------- 
  42     Construct empty() is not allowed. Use more strict comparison.   
  42     Variable $path_args in empty() always exists and is not falsy.  
 ------ ---------------------------------------------------------------- 

 ------ --------------------------------------------------------------- 
  Line   src/EventSubscriber/RedirectAfterLogoutSubscriber.php          
 ------ --------------------------------------------------------------- 
  59     Construct empty() is not allowed. Use more strict comparison.  
 ------ --------------------------------------------------------------- 

 ------ ----------------------------------------------------------------------- 
  Line   src/Form/RedirectLogoutSettings.php                                    
 ------ ----------------------------------------------------------------------- 
  50     Property                                                               
         Drupal\redirect_after_logout\Form\RedirectLogoutSettings::$requestCon  
         text has unknown class                                                 
         Drupal\redirect_after_logout\Form\Drupal\Core\Routing\RequestContext   
         as its type.                                                           
         💡 Learn more at https://phpstan.org/user-guide/discovering-symbols     
  147    Call to method getCompleteBaseUrl() on an unknown class                
         Drupal\redirect_after_logout\Form\Drupal\Core\Routing\RequestContext.  
         💡 Learn more at https://phpstan.org/user-guide/discovering-symbols     
 ------ ----------------------------------------------------------------------- 

 ------ ------------------------------------------- 
  Line   tests/src/Functional/SettingsTest.php      
 ------ ------------------------------------------- 
  75     Dynamic call to static method              
         PHPUnit\Framework\Assert::assertEquals().  
  76     Dynamic call to static method              
         PHPUnit\Framework\Assert::assertEquals().  
 ------ ------------------------------------------- 

 ------ ----------------------------------------------------------------------- 
  Line   tests/src/Functional/TestBase.php                                      
 ------ ----------------------------------------------------------------------- 
  58     Access to an undefined property                                        
         Drupal\Tests\redirect_after_logout\Functional\TestBase::$admin_user.   
  59     Access to an undefined property                                        
         Drupal\Tests\redirect_after_logout\Functional\TestBase::$authenticate  
         d_user.                                                                
  60     Access to an undefined property                                        
         Drupal\Tests\redirect_after_logout\Functional\TestBase::$regular_user  
         .                                                                      
 ------ ----------------------------------------------------------------------- 

 [ERROR] Found 10 errors                                                        

Thanks for using drupal-check!

Check code analysis and deprecations: (-ad)

www-data@cli-drupal9-test:/app$ drupal-check -ad /app/web/modules/custom/redirect_after_logout/
 9/9 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%

 ------ --------------------------------------------------------------------- 
  Line   redirect_after_logout.install                                        
 ------ --------------------------------------------------------------------- 
  11     Function redirect_after_logout_update_8101() has no return type      
         specified.                                                           
  11     Function redirect_after_logout_update_8101() has parameter $sandbox  
         with no type specified.                                              
 ------ --------------------------------------------------------------------- 

 ------ ----------------------------------------------------------------------- 
  Line   redirect_after_logout.module                                           
 ------ ----------------------------------------------------------------------- 
  16     Function redirect_after_logout_help() has no return type specified.    
  16     Function redirect_after_logout_help() has parameter $route_name with   
         no type specified.                                                     
  28     Function redirect_after_logout_page_attachments() has no return type   
         specified.                                                             
  28     Function redirect_after_logout_page_attachments() has parameter        
         $attachments with no value type specified in iterable type array.      
         💡 See:                                                                 
         https://phpstan.org/blog/solving-phpstan-no-value-type-specified-in-i  
         terable-type                                                           
  42     Construct empty() is not allowed. Use more strict comparison.          
  42     Variable $path_args in empty() always exists and is not falsy.         
  53     Function redirect_after_logout_user_logout() has no return type        
         specified.                                                             
  53     Function redirect_after_logout_user_logout() has parameter $account    
         with no type specified.                                                
 ------ ----------------------------------------------------------------------- 

 ------ ----------------------------------------------------------------------- 
  Line   src/EventSubscriber/RedirectAfterLogoutSubscriber.php                  
 ------ ----------------------------------------------------------------------- 
  40     Method                                                                 
         Drupal\redirect_after_logout\EventSubscriber\RedirectAfterLogoutSubsc  
         riber::checkRedirection() has no return type specified.                
  59     Construct empty() is not allowed. Use more strict comparison.          
 ------ ----------------------------------------------------------------------- 

 ------ ----------------------------------------------------------------------- 
  Line   src/Form/RedirectLogoutSettings.php                                    
 ------ ----------------------------------------------------------------------- 
  50     Property                                                               
         Drupal\redirect_after_logout\Form\RedirectLogoutSettings::$requestCon  
         text has unknown class                                                 
         Drupal\redirect_after_logout\Form\Drupal\Core\Routing\RequestContext   
         as its type.                                                           
         💡 Learn more at https://phpstan.org/user-guide/discovering-symbols     
  60     Property                                                               
         Drupal\redirect_after_logout\Form\RedirectLogoutSettings::$requestCon  
         text                                                                   
         (Drupal\redirect_after_logout\Form\Drupal\Core\Routing\RequestContext  
         ) does not accept Drupal\Core\Routing\RequestContext.                  
  66     Method                                                                 
         Drupal\redirect_after_logout\Form\RedirectLogoutSettings::create()     
         has no return type specified.                                          
  89     Method                                                                 
         Drupal\redirect_after_logout\Form\RedirectLogoutSettings::getEditable  
         ConfigNames() return type has no value type specified in iterable      
         type array.                                                            
         💡 See:                                                                 
         https://phpstan.org/blog/solving-phpstan-no-value-type-specified-in-i  
         terable-type                                                           
  104    Method                                                                 
         Drupal\redirect_after_logout\Form\RedirectLogoutSettings::buildForm()  
         has parameter $form with no value type specified in iterable type      
         array.                                                                 
         💡 See:                                                                 
         https://phpstan.org/blog/solving-phpstan-no-value-type-specified-in-i  
         terable-type                                                           
  104    Method                                                                 
         Drupal\redirect_after_logout\Form\RedirectLogoutSettings::buildForm()  
         return type has no value type specified in iterable type array.        
         💡 See:                                                                 
         https://phpstan.org/blog/solving-phpstan-no-value-type-specified-in-i  
         terable-type                                                           
  144    Method                                                                 
         Drupal\redirect_after_logout\Form\RedirectLogoutSettings::validateFor  
         m() has no return type specified.                                      
  144    Method                                                                 
         Drupal\redirect_after_logout\Form\RedirectLogoutSettings::validateFor  
         m() has parameter $form with no value type specified in iterable type  
         array.                                                                 
         💡 See:                                                                 
         https://phpstan.org/blog/solving-phpstan-no-value-type-specified-in-i  
         terable-type                                                           
  147    Call to method getCompleteBaseUrl() on an unknown class                
         Drupal\redirect_after_logout\Form\Drupal\Core\Routing\RequestContext.  
         💡 Learn more at https://phpstan.org/user-guide/discovering-symbols     
  188    Method                                                                 
         Drupal\redirect_after_logout\Form\RedirectLogoutSettings::submitForm(  
         ) has no return type specified.                                        
  188    Method                                                                 
         Drupal\redirect_after_logout\Form\RedirectLogoutSettings::submitForm(  
         ) has parameter $form with no value type specified in iterable type    
         array.                                                                 
         💡 See:                                                                 
         https://phpstan.org/blog/solving-phpstan-no-value-type-specified-in-i  
         terable-type                                                           
 ------ ----------------------------------------------------------------------- 

 ------ ----------------------------------------------------------------------- 
  Line   tests/src/Functional/SettingsTest.php                                  
 ------ ----------------------------------------------------------------------- 
  30     Method                                                                 
         Drupal\Tests\redirect_after_logout\Functional\SettingsTest::testSetti  
         ngsPageAccess() has no return type specified.                          
  48     Method                                                                 
         Drupal\Tests\redirect_after_logout\Functional\SettingsTest::testSetti  
         ngsForm() has no return type specified.                                
  75     Dynamic call to static method                                          
         PHPUnit\Framework\Assert::assertEquals().                              
  76     Dynamic call to static method                                          
         PHPUnit\Framework\Assert::assertEquals().                              
  85     Method                                                                 
         Drupal\Tests\redirect_after_logout\Functional\SettingsTest::testSetti  
         ngsFormDestinationValidation() has no return type specified.           
 ------ ----------------------------------------------------------------------- 

 ------ ----------------------------------------------------------------------- 
  Line   tests/src/Functional/SettingsTestToken.php                             
 ------ ----------------------------------------------------------------------- 
  28     Method                                                                 
         Drupal\Tests\redirect_after_logout\Functional\SettingsTestToken::test  
         SettingsFormWithToken() has no return type specified.                  
 ------ ----------------------------------------------------------------------- 

 ------ ----------------------------------------------------------------------- 
  Line   tests/src/Functional/SimpleLogoutTest.php                              
 ------ ----------------------------------------------------------------------- 
  27     Method                                                                 
         Drupal\Tests\redirect_after_logout\Functional\SimpleLogoutTest::testL  
         ogoutWithoutToken() has no return type specified.                      
 ------ ----------------------------------------------------------------------- 

 ------ ----------------------------------------------------------------------- 
  Line   tests/src/Functional/TestBase.php                                      
 ------ ----------------------------------------------------------------------- 
  58     Access to an undefined property                                        
         Drupal\Tests\redirect_after_logout\Functional\TestBase::$admin_user.   
  59     Access to an undefined property                                        
         Drupal\Tests\redirect_after_logout\Functional\TestBase::$authenticate  
         d_user.                                                                
  60     Access to an undefined property                                        
         Drupal\Tests\redirect_after_logout\Functional\TestBase::$regular_user  
         .                                                                      
  71     Method                                                                 
         Drupal\Tests\redirect_after_logout\Functional\TestBase::drupalLogoutW  
         ithoutCheck() has no return type specified.                            
  79     Property Drupal\Tests\BrowserTestBase::$loggedInUser                   
         (Drupal\user\UserInterface) does not accept false.                     
 ------ ----------------------------------------------------------------------- 

 ------ ----------------------------------------------------------------------- 
  Line   tests/src/Functional/TokenLogoutTest.php                               
 ------ ----------------------------------------------------------------------- 
  33     Method                                                                 
         Drupal\Tests\redirect_after_logout\Functional\TokenLogoutTest::testLo  
         goutWithoutToken() has no return type specified.                       
 ------ ----------------------------------------------------------------------- 

 [ERROR] Found 36 errors                                                        

Thanks for using drupal-check!
atul_ghate’s picture

Assigned: atul_ghate » Unassigned
StatusFileSize
new128.69 KB

On my local machine, patch #8 has resolved all coding standard issues

nevergone’s picture

@atul ghate:

Ok, I agree. But phpcs is faster and less precise. Drupal-check (based of phpstan) is better code analysis tool. See #3293261-10: Drupal Coding Standard Issue As per 'phpcs --standard=Drupal' comment.
The tests is coudn't run:

www-data@cli-drupal9-test:/app$ ./vendor/bin/phpunit -v -c /app/web/core/phpunit.xml /app/web/modules/custom/redirect_after_logout/tests/src/Functional/SettingsTest.php
PHPUnit 8.5.26 #StandWithUkraine

Runtime:       PHP 7.4.3
Configuration: /app/web/core/phpunit.xml

Testing Drupal\Tests\redirect_after_logout\Functional\SettingsTest
EEE                                                                 3 / 3 (100%)

Time: 28.99 seconds, Memory: 8.00 MB

There were 3 errors:

1) Drupal\Tests\redirect_after_logout\Functional\SettingsTest::testSettingsPageAccess
TypeError: Argument 1 passed to Drupal\Tests\BrowserTestBase::drupalLogin() must implement interface Drupal\Core\Session\AccountInterface, null given, called in /app/web/modules/custom/redirect_after_logout/tests/src/Functional/SettingsTest.php on line 33

/app/web/core/tests/Drupal/Tests/UiHelperTrait.php:248
/app/web/modules/custom/redirect_after_logout/tests/src/Functional/SettingsTest.php:33
/app/vendor/phpunit/phpunit/src/Framework/TestResult.php:703

2) Drupal\Tests\redirect_after_logout\Functional\SettingsTest::testSettingsForm
TypeError: Argument 1 passed to Drupal\Tests\BrowserTestBase::drupalLogin() must implement interface Drupal\Core\Session\AccountInterface, null given, called in /app/web/modules/custom/redirect_after_logout/tests/src/Functional/SettingsTest.php on line 49

/app/web/core/tests/Drupal/Tests/UiHelperTrait.php:248
/app/web/modules/custom/redirect_after_logout/tests/src/Functional/SettingsTest.php:49
/app/vendor/phpunit/phpunit/src/Framework/TestResult.php:703

3) Drupal\Tests\redirect_after_logout\Functional\SettingsTest::testSettingsFormDestinationValidation
TypeError: Argument 1 passed to Drupal\Tests\BrowserTestBase::drupalLogin() must implement interface Drupal\Core\Session\AccountInterface, null given, called in /app/web/modules/custom/redirect_after_logout/tests/src/Functional/SettingsTest.php on line 92

/app/web/core/tests/Drupal/Tests/UiHelperTrait.php:248
/app/web/modules/custom/redirect_after_logout/tests/src/Functional/SettingsTest.php:92
/app/vendor/phpunit/phpunit/src/Framework/TestResult.php:703

ERRORS!
Tests: 3, Assertions: 28, Errors: 3.
nevergone’s picture

dipesh_goswami made their first commit to this issue’s fork.

anoopsingh92’s picture

Assigned: Unassigned » anoopsingh92

Hi,

I am checking this issue.

Thanks

anoopsingh92’s picture

Hello,

Please review this patch.

Thanks

anoopsingh92’s picture

Assigned: anoopsingh92 » Unassigned
Status: Needs work » Needs review
nevergone’s picture

@anoopsingh92

Thanks the patch!

diff --git a/tests/src/Functional/SimpleLogoutTest.php b/tests/src/Functional/SimpleLogoutTest.php
index b48beed..c389911 100644
--- a/tests/src/Functional/SimpleLogoutTest.php
+++ b/tests/src/Functional/SimpleLogoutTest.php
@@ -8,7 +8,11 @@ namespace Drupal\Tests\redirect_after_logout\Functional;
  * @group redirect_after_logout
  */
 class SimpleLogoutTest extends TestBase {
-
+  /**
+   * Test settings page.
+   *
+   * @var Testsettingsformconfiguration
+   */
   protected static $modules = [
     'redirect_after_logout',
   ];

The "Testsettingsformconfiguration" what does it mean?

anoopsingh92’s picture

Hello @nevergone,

I really don't know from where it came probably some issue with the PHP coder.

I am uploading another Patch.

Thanks

anoopsingh92’s picture

Hi,

Please review this patch.

Thanks

nevergone’s picture

+++ b/tests/src/Functional/TestBase.php
@@ -24,22 +25,33 @@ abstract class TestBase extends BrowserTestBase {
   /**
+   * The admin user.
+   *
    * @var \Drupal\user\Entity\User
    */
-  protected $admin_user;
+  protected $adminUser;
 
   /**
+   * The authenticated user.
+   *
    * @var \Drupal\user\Entity\User
    */
-  protected $authenticated_user;
+  protected $authenticatedUser;
 
   /**
+   * The regular user.
+   *
    * @var \Drupal\user\Entity\User
    */
-  protected $regular_user;
+  protected $regularUser;

Why rename the variables?

  • anoopsingh92 authored 684cd7b on 8.x-1.x
    Issue #3293261 by anoopsingh92, mrinalini9, Rakhi Soni, dipesh_goswami,...
nevergone’s picture

Status: Needs review » Fixed
StatusFileSize
new13.91 KB
new3.65 KB

Patch re-rolled and fixed.

Thanks the contribution!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.