diff --git a/metatag_views/tests/src/Functional/MetatagViewsBasicsTest.php b/metatag_views/tests/src/Functional/MetatagViewsBasicsTest.php index fba2eef..3415896 100644 --- a/metatag_views/tests/src/Functional/MetatagViewsBasicsTest.php +++ b/metatag_views/tests/src/Functional/MetatagViewsBasicsTest.php @@ -2,8 +2,8 @@ namespace Drupal\Tests\metatag_views\Functional; -use Drupal\user\Entity\User; use Drupal\Tests\BrowserTestBase; +use Drupal\Tests\metatag\Functional\MetatagHelperTrait; /** * Confirm the defaults functionality works. @@ -12,6 +12,8 @@ */ class MetatagViewsBasicsTest extends BrowserTestBase { + use MetatagHelperTrait; + /** * {@inheritdoc} */ @@ -134,19 +136,4 @@ public function testSiteStillWorks() { $this->assertTitle('Metatag title'); } - /** - * Log in as user 1. - */ - protected function loginUser1() { - // Log in as user 1. - /* @var \Drupal\user\Entity\User $account */ - $account = User::load(1); - $password = 'foo'; - $account->setPassword($password)->save(); - // Support old and new tests. - $account->passRaw = $password; - $account->pass_raw = $password; - $this->drupalLogin($account); - } - } diff --git a/tests/src/Functional/MetatagHelperTrait.php b/tests/src/Functional/MetatagHelperTrait.php new file mode 100644 index 0000000..6d63315 --- /dev/null +++ b/tests/src/Functional/MetatagHelperTrait.php @@ -0,0 +1,28 @@ +setPassword($password)->save(); + // Support old and new tests. + $account->passRaw = $password; + $account->pass_raw = $password; + $this->drupalLogin($account); + } + +}