trait CoreVersionUiTestTrait in Diff 8
Maintains differences between 8.3.x and 8.4.x for tests.
Hierarchy
- trait \Drupal\Tests\diff\Functional\CoreVersionUiTestTrait
1 file declares its use of CoreVersionUiTestTrait
- DiffLocaleTest.php in tests/
src/ FunctionalJavascript/ DiffLocaleTest.php
File
- tests/
src/ Functional/ CoreVersionUiTestTrait.php, line 8
Namespace
Drupal\Tests\diff\FunctionalView source
trait CoreVersionUiTestTrait {
/**
* Posts the node form depending on core version.
*
* @param string|\Drupal\Core\Url $path
* The path to post the form.
* @param array $edit
* An array of values to post.
* @param string $submit
* The label of the submit button to post.
*/
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);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
CoreVersionUiTestTrait:: |
protected | function | Posts the node form depending on core version. | 1 |