ContentTypeViewModeCreateTest.php in Facebook Instant Articles 8.2
File
tests/src/Functional/ContentTypeViewModeCreateTest.php
View source
<?php
namespace Drupal\Tests\fb_instant_articles\Functional;
use Drupal\Core\Url;
use Drupal\Tests\BrowserTestBase;
class ContentTypeViewModeCreateTest extends BrowserTestBase {
protected static $modules = [
'fb_instant_articles',
'node',
'field_ui',
];
protected $permissions = [
'access administration pages',
'administer content types',
'administer display modes',
'administer node display',
'administer site configuration',
'administer fb_instant_articles',
];
protected $adminUser;
protected $defaultTheme = 'stark';
protected function setUp() : void {
parent::setUp();
$this->adminUser = $this
->drupalCreateUser($this->permissions);
$this
->drupalLogin($this->adminUser);
}
public function testCreateContentTypeFbia() {
$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.');
$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');
}
}