Updated all the contrib modules to their latest versions.
[yaffs-website] / web / modules / contrib / diff / tests / src / Functional / CoreVersionUiTestTrait.php
1 <?php
2
3 namespace Drupal\Tests\diff\Functional;
4
5 /**
6  * Maintains differences between 8.3.x and 8.4.x for tests.
7  */
8 trait CoreVersionUiTestTrait {
9
10   /**
11    * Posts the node form depending on core version.
12    *
13    * @param string|\Drupal\Core\Url $path
14    *   The path to post the form.
15    * @param array $edit
16    *   An array of values to post.
17    * @param string $submit
18    *   The label of the submit button to post.
19    */
20   protected function drupalPostNodeForm($path, array $edit, $submit) {
21     if (!version_compare(\Drupal::VERSION, '8.4', '<')) {
22       // Check for translations.
23       if (strpos($submit, 'translation') !== FALSE) {
24         $submit = t('Save (this translation)');
25       }
26       else {
27         // Form button is back to simply 'Save'.
28         $submit = t('Save');
29       }
30
31       // Check the publish checkbox.
32       if (strpos($submit, 'publish') !== FALSE) {
33         $edit['status[value]'] = 1;
34       }
35     }
36     $this->drupalPostForm($path, $edit, $submit);
37   }
38
39 }