You are here

public function EntityAnalyserTest::setUp in Real-time SEO for Drupal 8.2

Overrides KernelTestBase::setUp

File

tests/src/Kernel/EntityAnalyserTest.php, line 56

Class

EntityAnalyserTest
Tests the entity analyzer.

Namespace

Drupal\Tests\yoast_seo\Kernel

Code

public function setUp() {
  parent::setUp();

  // Set up everything needed to be able to use nodes.
  $this
    ->installSchema('system', 'sequences');
  $this
    ->installSchema('node', 'node_access');
  $this
    ->installEntitySchema('user');
  $this
    ->installEntitySchema('node');
  $this
    ->installEntitySchema('date_format');
  $this
    ->installConfig('filter');
  $this
    ->installConfig('node');

  // Install the default metatag configuration which sets some presets for
  // tokens that affect how rendering happens.
  $this
    ->installConfig('metatag');

  // Create an article content type that we will use for testing.
  $this
    ->drupalCreateContentType([
    'type' => 'article',
    'name' => 'Article',
    'display_submitted' => FALSE,
  ]);
  DateFormat::create([
    'id' => 'fallback',
    'label' => 'Fallback',
    'pattern' => 'Y-m-d',
  ])
    ->save();

  // Add our test field to the node type.
  $this
    ->createYoastSeoField('node', 'article', 'field_seo', 'SEO');
  $this->entityAnalyzer = $this->container
    ->get('yoast_seo.entity_analyser');
}