ContributeFunctionalTest.php in Contribute 8
File
tests/src/Functional/ContributeFunctionalTest.php
View source
<?php
namespace Drupal\Tests\contribute\Functional;
use Drupal\Tests\BrowserTestBase;
class ContributeFunctionalTest extends BrowserTestBase {
protected $defaultTheme = 'stark';
public static $modules = [
'contribute',
];
public function testStatusReport() {
$this
->drupalLogin($this->rootUser);
$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.');
$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>');
$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>');
$edit = [
'disable' => TRUE,
];
$this
->drupalPostForm('/admin/reports/status/contribute/configure', $edit, t('Save'));
$this
->assertSession()
->responseContains('Community information has been disabled.');
$this
->drupalGet('/admin/reports/status');
$this
->assertSession()
->responseNotContains('Community information');
}
}