You are here

protected function SchemaMetatagTagsTestBase::setUp in Schema.org Metatag 8.2

Same name and namespace in other branches
  1. 8 tests/src/Functional/SchemaMetatagTagsTestBase.php \Drupal\Tests\schema_metatag\Functional\SchemaMetatagTagsTestBase::setUp()

Overrides BrowserTestBase::setUp

File

tests/src/Functional/SchemaMetatagTagsTestBase.php, line 156

Class

SchemaMetatagTagsTestBase
Base class to test all of the meta tags that are in a specific module.

Namespace

Drupal\Tests\schema_metatag\Functional

Code

protected function setUp() {
  parent::setUp();
  $this->propertyTypeManager = \Drupal::service('plugin.manager.schema_property_type');
  $this->metatagTagManager = \Drupal::service('plugin.manager.metatag.tag');
  $this->propertyTypes = $this
    ->getPropertyTypes();
  $this->treeParent = $this
    ->getTreeParent();

  // Initiate session with a user who can manage metatags and access content.
  $permissions = [
    'administer site configuration',
    'administer meta tags',
    'access content',
  ];
  $account = $this
    ->drupalCreateUser($permissions);
  $this
    ->drupalLogin($account);

  // Create a content type to test with.
  $this
    ->createContentType([
    'type' => 'page',
  ]);
  $this
    ->drupalCreateNode([
    'title' => 'Node 1!',
    'type' => 'page',
    'promote' => 1,
  ]);

  // Make sure the home page is a valid route in case we want to test it.
  $this
    ->config('system.site')
    ->set('page.front', '/node')
    ->save();
  $this
    ->clear();
}