You are here

public function NodeTypeFormTest::testWithExistingContentType in Node Option Premium 8

Tests setting premium for existing content type.

File

tests/src/Functional/Form/NodeTypeFormTest.php, line 36

Class

NodeTypeFormTest
Tests configuring the settings on the node type form.

Namespace

Drupal\Tests\nopremium\Functional\Form

Code

public function testWithExistingContentType() {
  $this
    ->drupalLogin($this->admin);
  $this
    ->drupalCreateContentType([
    'type' => 'foo',
  ]);

  // Assert that the content type is not premium yet.
  $config = $this
    ->config('core.base_field_override.node.foo.premium');
  $this
    ->assertNull($config
    ->get('default_value'));

  // Enable premium on this content type.
  $edit = [
    'options[premium]' => TRUE,
  ];
  $this
    ->drupalPostForm('admin/structure/types/manage/foo', $edit, 'Save content type');

  // Assert that premium was enabled for this content type.
  $config = $this
    ->config('core.base_field_override.node.foo.premium');
  $this
    ->assertEquals(TRUE, $config
    ->get('default_value')[0]['value']);
}