easy_social-8.x-3.x-dev/tests/src/Functional/EasySocialTest.php
tests/src/Functional/EasySocialTest.php
<?php
declare(strict_types=1);
namespace Drupal\Tests\easy_social\Functional;
use Drupal\Core\Url;
use Drupal\Tests\BrowserTestBase;
use Drupal\user\Entity\User;
use PHPUnit\Framework\Attributes\Group;
/**
* Test basic module functionality.
*/
#[Group('easy_social')]
final class EasySocialTest extends BrowserTestBase {
/**
* {@inheritdoc}
*/
protected $defaultTheme = 'stark';
/**
* {@inheritdoc}
*/
protected static $modules = [
'easy_social',
'easy_social_example',
];
protected User $adminUser;
/**
* {@inheritdoc}
*/
protected function setUp(): void {
parent::setUp();
$this->adminUser = $this->drupalCreateUser(['administer easy_social']);
}
/**
* Test module installation.
*/
public function testInstallation(): void {
$this->drupalLogin($this->adminUser);
$this->drupalGet(Url::fromRoute('easy_social.settings'));
$this->assertSession()->elementExists('xpath', '//h1[text() = "Easy Social"]');
$this->assertSession()->pageTextContains('Advanced settings');
$this->drupalGet(Url::fromRoute('easy_social.settings_email'));
$this->assertSession()->elementExists('xpath', '//h1[text() = "Easy Social Email"]');
$this->drupalGet(Url::fromRoute('easy_social.settings_facebook'));
$this->assertSession()->elementExists('xpath', '//h1[text() = "Easy Social FaceBook"]');
$this->drupalGet(Url::fromRoute('easy_social.settings_linkedin'));
$this->assertSession()->elementExists('xpath', '//h1[text() = "Easy Social LinkedIn"]');
$this->drupalGet(Url::fromRoute('easy_social.settings_pinterest'));
$this->assertSession()->elementExists('xpath', '//h1[text() = "Easy Social Pinterest"]');
$this->drupalGet(Url::fromRoute('easy_social.settings_twitter'));
$this->assertSession()->elementExists('xpath', '//h1[text() = "Easy Social Twitter"]');
$this->drupalGet(Url::fromRoute('easy_social_example.settings'));
$this->assertSession()->elementExists('xpath', '//h1[text() = "Easy Social Foo Baz"]');
}
}
