You are here

public function NodeRevisionsAutocleanTest::testDrupalPostForm in Node Revisions Autoclean 8

Test post form.

File

tests/src/Functional/NodeRevisionsAutocleanTest.php, line 219

Class

NodeRevisionsAutocleanTest
Class NodeRevisionsAutocleanTest.

Namespace

Drupal\Tests\node_revisions_autoclean\Functional

Code

public function testDrupalPostForm() {
  $assert = $this
    ->assertSession();
  $user = $this
    ->drupalCreateUser([
    'configure revisions autoclean settings',
  ]);
  $this
    ->drupalLogin($user);
  $this
    ->drupalGet('/admin/config/content/revisions-autoclean');
  $this
    ->drupalPostForm(NULL, [
    'enable_on_cron' => '0',
    'enable_on_node_update' => '1',
    'node__article' => '2',
    'node_enable_date_article' => '1',
    'interval__article' => 'P1W',
    'node__page' => '2',
    'node_enable_date_page' => '0',
    'interval__page' => 'P1W',
  ], $this
    ->t('Submit'));
  $config = \Drupal::config('node_revisions_autoclean.settings');
  $this
    ->assertEquals('0', $config
    ->get('enable_on_cron'), 'Value for enable_on_cron ' . $config
    ->get('enable_on_cron'));
  $this
    ->assertEquals('1', $config
    ->get('enable_on_node_update'), 'Value for enable_on_node_update : ' . $config
    ->get('enable_on_node_update'));
  $this
    ->assertEquals('2', $config
    ->get('node.article'), 'Value for node.article : ' . $config
    ->get('node.article'));
  $this
    ->assertEquals('P1W', $config
    ->get('interval.article'), 'Value for interval.article : ' . $config
    ->get('interval.article'));
  $this
    ->assertEquals('2', $config
    ->get('node.page'), 'Value for node.page : ' . $config
    ->get('node.page'));
  $this
    ->assertEquals('0', $config
    ->get('interval.page'), 'Value for interval.page : ' . $config
    ->get('interval.page'));
  $assert
    ->pageTextContains('Node revisions settings have been updated.');
}