You are here

public function ContributeFunctionalTest::testStatusReport in Contribute 8

Test get.

File

tests/src/Functional/ContributeFunctionalTest.php, line 27

Class

ContributeFunctionalTest
Contribute browser test.

Namespace

Drupal\Tests\contribute\Functional

Code

public function testStatusReport() {
  $this
    ->drupalLogin($this->rootUser);

  // Check that the 'Status report' includes 'Community information'.
  $this
    ->drupalGet('/admin/reports/status');
  $this
    ->assertSession()
    ->responseContains('Community information');
  $this
    ->assertSession()
    ->responseContains('When you <a href="https://register.drupal.org/user/register">create a Drupal.org account</a>, you gain access to a whole ecosystem of Drupal.org sites and services.');

  // Check that the 'Status report' includes jrockowitz's user information.
  $edit = [
    'account_type' => 'user',
    'user_id' => 'jrockowitz',
  ];
  $this
    ->drupalPostForm('/admin/reports/status/contribute/configure', $edit, t('Save'));
  $this
    ->assertSession()
    ->responseContains('Community information has been saved.');
  $this
    ->assertSession()
    ->responseContains('Community information');
  $this
    ->assertSession()
    ->responseNotContains('When you <a href="https://register.drupal.org/user/register">create a Drupal.org account</a>, you gain access to a whole ecosystem of Drupal.org sites and services.');
  $this
    ->assertSession()
    ->responseContains('<strong><a href="https://www.drupal.org/u/jrockowitz">Jacob Rockowitz</a></strong>');

  // Check that 'Community information' can be cleared.
  $this
    ->drupalPostForm('/admin/reports/status/contribute/configure', [], t('Clear'));
  $this
    ->assertSession()
    ->responseContains('Community information has been cleared.');
  $this
    ->assertSession()
    ->responseNotContains('<strong><a href="https://www.drupal.org/u/jrockowitz">Jacob Rockowitz</a></strong>');

  // Check that 'Community information' can be disabled.
  $edit = [
    'disable' => TRUE,
  ];
  $this
    ->drupalPostForm('/admin/reports/status/contribute/configure', $edit, t('Save'));
  $this
    ->assertSession()
    ->responseContains('Community information has been disabled.');

  // Check that 'Community information' can be remove.
  $this
    ->drupalGet('/admin/reports/status');
  $this
    ->assertSession()
    ->responseNotContains('Community information');
}