OpignoStatisticsTest.php in Opigno statistics 3.x
File
tests/src/Functional/OpignoStatisticsTest.php
View source
<?php
namespace Drupal\Tests\opigno_statistics\Functional;
class OpignoStatisticsTest extends OpignoStatisticsBrowserTestBase {
public function testOpignoStatisticsPagesAccess() {
$statistics_manager = $this
->drupalCreateUser();
$statistics_manager
->addRole('statistics_reader');
$statistics_manager
->save();
$this
->drupalLogin($statistics_manager);
$this->accountSwitcher
->switchTo($statistics_manager);
$training = $this
->createGroup();
$this
->drupalGet('/statistics/dashboard');
$assertSession = $this
->assertSession();
$assertSession
->addressEquals('/statistics/dashboard');
$assertSession
->statusCodeEquals(200, 'Global statistics manager has access to a statistics dashboard page.');
$this
->drupalGet('/statistics/training/' . $training
->id());
$assertSession = $this
->assertSession();
$assertSession
->pageTextContains($training
->label());
$assertSession
->statusCodeEquals(200, 'Global statistics manager has access to a statistics any training page.');
$this
->drupalGet('/user/' . $this->groupCreator
->id());
$this
->assertSession()
->statusCodeEquals(200, 'Global statistics manager has access to a user profile page.');
}
}