You are here

protected function CoreVersionUiTestTrait::drupalPostNodeForm in Diff 8

Posts the node form depending on core version.

Parameters

string|\Drupal\Core\Url $path: The path to post the form.

array $edit: An array of values to post.

string $submit: The label of the submit button to post.

20 calls to CoreVersionUiTestTrait::drupalPostNodeForm()
DiffAdminFormsTest::testPluginWeight in tests/src/Functional/DiffAdminFormsTest.php
Tests the Compare Revisions vertical tab.
DiffLocaleTest::doTestTranslationRevisions in tests/src/FunctionalJavascript/DiffLocaleTest.php
Test Diff functionality for the revisions of a translated node.
DiffPluginEntityTest::testEntityReferencePlugin in tests/src/Functional/DiffPluginEntityTest.php
Tests the EntityReference plugin.
DiffPluginFileTest::testFilePlugin in tests/src/Functional/DiffPluginFileTest.php
Tests the File plugin.
DiffPluginFileTest::testImagePlugin in tests/src/Functional/DiffPluginFileTest.php
Tests the Image plugin.

... See full list

1 method overrides CoreVersionUiTestTrait::drupalPostNodeForm()
DiffRevisionContentModerationTest::drupalPostNodeForm in tests/src/Functional/DiffRevisionContentModerationTest.php
Override form submission to work with content moderation.

File

tests/src/Functional/CoreVersionUiTestTrait.php, line 20

Class

CoreVersionUiTestTrait
Maintains differences between 8.3.x and 8.4.x for tests.

Namespace

Drupal\Tests\diff\Functional

Code

protected function drupalPostNodeForm($path, array $edit, $submit) {
  if (!version_compare(\Drupal::VERSION, '8.4', '<')) {

    // Check for translations.
    if (strpos($submit, 'translation') !== FALSE) {
      $submit = t('Save (this translation)');
    }
    else {

      // Form button is back to simply 'Save'.
      $submit = t('Save');
    }

    // Check the publish checkbox.
    if (strpos($submit, 'publish') !== FALSE) {
      $edit['status[value]'] = 1;
    }
  }
  $this
    ->drupalPostForm($path, $edit, $submit);
}