You are here

public function YoastSeoTest::testYoastSeoEnabledDisabled in Real-time SEO for Drupal 8

Only available when it has been previously enabled on the content type.

Given I am logged in as admin When I am adding a content on a content type which doesn't have a Meta Tag field Then Then I should not see the Yoast SEO section active When I am adding a content on a content type which have a Meta Tag field.

File

src/Tests/YoastSeoTest.php, line 97

Class

YoastSeoTest
Ensures that the Yoast Seo works correctly.

Namespace

Drupal\yoast_seo\Tests

Code

public function testYoastSeoEnabledDisabled() {

  // Given I am logged in as admin.
  $this
    ->drupalLogin($this->adminUser);

  // Create a page node type.
  $this->entityManager
    ->getStorage('node_type')
    ->create([
    'type' => 'page',
    'name' => 'page',
  ])
    ->save();

  // When I am adding an Entity Test content.
  $this
    ->drupalGet('node/add/page');

  // Then I should not see the Yoast SEO section active.
  $this
    ->assertSession()
    ->pageTextNotContains('Yoast SEO for drupal');

  // When I enable Yoast SEO for the page bundle.
  $this
    ->enableYoastSeo('node', 'page');

  // And I am adding an Entity Test content.
  $this
    ->drupalGet('node/add/page');

  // Then I should see the Yoast SEO section active.
  $this
    ->assertSession()
    ->pageTextContains('Real-time SEO for drupal');

  // When I disable Yoast SEO for the page bundle.
  $this
    ->disableYoastSeo('node', 'page');

  // And I am adding an Entity Test content.
  $this
    ->drupalGet('node/add/page');

  // Then I should not see the Yoast SEO section active.
  $this
    ->assertSession()
    ->pageTextNotContains('Real-time SEO for drupal');
}