You are here

public function ContentTypeViewModeCreateTest::testCreateContentTypeFbia in Facebook Instant Articles 3.x

Same name and namespace in other branches
  1. 8.2 tests/src/Functional/ContentTypeViewModeCreateTest.php \Drupal\Tests\fb_instant_articles\Functional\ContentTypeViewModeCreateTest::testCreateContentTypeFbia()

Test creating a new content type with FBIA toggled on.

File

tests/src/Functional/ContentTypeViewModeCreateTest.php, line 68

Class

ContentTypeViewModeCreateTest
Test toggling the FBIA view mode while creating the content type.

Namespace

Drupal\Tests\fb_instant_articles\Functional

Code

public function testCreateContentTypeFbia() {

  // Enable FBIA display on a new content type.
  $this
    ->drupalGet(Url::fromRoute('node.type_add')
    ->toString());
  $this
    ->assertSession()
    ->statusCodeEquals(200);
  $edit = [
    'name' => 'Test',
    'type' => 'test',
    'fb_instant_articles_enabled' => '1',
  ];
  $this
    ->submitForm($edit, t('Save and manage fields'));
  $this
    ->assertSession()
    ->pageTextContains('The content type test has been added.');

  // Check that the FBIA view mode has been turned on.
  $view_mode_url = Url::fromRoute('entity.entity_view_display.node.default', [
    'node_type' => 'test',
  ])
    ->toString();
  $this
    ->drupalGet($view_mode_url);
  $this
    ->assertSession()
    ->statusCodeEquals(200);
  $this
    ->assertSession()
    ->checkboxChecked('edit-display-modes-custom-fb-instant-articles');
}