PageLoadProgressAdminSettingsTest.php in Page Load Progress 8        
                          
                  
                        
  
  
  
  
  
File
  tests/src/Functional/PageLoadProgressAdminSettingsTest.php
  
    View source  
  <?php
namespace Drupal\Tests\page_load_progress\Functional;
use Drupal\Tests\BrowserTestBase;
use Drupal\Core\Url;
class PageLoadProgressAdminSettingsTest extends BrowserTestBase {
  
  protected $adminUser;
  
  public static $modules = [
    'page_load_progress',
  ];
  
  protected $profile = 'minimal';
  
  public static function getInfo() {
    return [
      'name' => 'Page Load Progress admin settings',
      'description' => 'Tests the Page Load Progress admin settings.',
      'group' => 'Page Load Progress',
    ];
  }
  
  protected function setUp() {
    parent::setUp();
    
    $this->adminUser = $this
      ->drupalCreateUser([
      'administer site configuration',
      'access administration pages',
      'administer permissions',
      'administer page load progress',
    ]);
    $this
      ->drupalLogin($this->adminUser);
  }
  
  public function testAdminPages() {
    
    $this
      ->drupalGet(Url::fromRoute('system.admin_config_ui'));
    $this
      ->assertSession()
      ->statusCodeEquals(200);
    $this
      ->assertSession()
      ->pageTextContains('Page Load Progress');
    
    $this
      ->drupalGet(Url::fromRoute('page_load_progress.admin_settings'));
    $this
      ->assertSession()
      ->statusCodeEquals(200);
    
    $this
      ->drupalLogout();
    $this
      ->drupalGet(Url::fromRoute('system.admin_config_ui'));
    $this
      ->assertSession()
      ->statusCodeEquals(403);
  }
}