[ Index ]

PHP Cross Reference of YOURLS

title

Body

[close]

/tests/tests/auth/ -> login_redirection.php (source)

   1  <?php
   2  
   3  /**
   4   * Login redirection
   5   *
   6   * Check that, when submitting correct credentials, we're redirected as expected
   7   *
   8   * @group auth
   9   */
  10  class Login_Redirection_Tests extends PHPUnit\Framework\TestCase {
  11  
  12      protected $backup_request;
  13      protected $backup_server;
  14  
  15      protected function setUp(): void {
  16          $this->backup_request = $_REQUEST;
  17          $this->backup_server  = $_SERVER;
  18      }
  19  
  20      protected function tearDown(): void {
  21          $_REQUEST = $this->backup_request;
  22          $_SERVER  = $this->backup_server;
  23      }
  24  
  25      /**
  26       * Check that authentication on a webpage triggers a redirection
  27       */
  28  	public function test_login() {
  29          $_REQUEST['nonce'] = yourls_create_nonce('admin_login');
  30          $_SERVER['REQUEST_URI'] = '/';
  31          $this->assertSame( 3, yourls_is_valid_user() );
  32      }
  33  
  34  }


Generated: Wed Sep 28 05:10:02 2022 Cross-referenced by PHPXref 0.7.1