Verified Commit 64962528 authored by Alex Pott's avatar Alex Pott
Browse files

Issue #3280033 by hmendes, rajandro, dpi, Ayesh: PHP 8.2 compatibility: ${}...

Issue #3280033 by hmendes, rajandro, dpi, Ayesh: PHP 8.2 compatibility: ${} string interpolation deprecated

(cherry picked from commit 3b3e794a)
parent 03bdeb1d
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -101,7 +101,7 @@ public function __construct(\Traversable $namespaces, CacheBackendInterface $cac
   * by one module, set the plugin ID as the value for the key corresponding to
   * the module name. To specify a plugin for a particular message sent by one
   * module, set the plugin ID as the value for the array key that is the
   * message ID, which is "${module}_${key}".
   * message ID, which is "{$module}_{$key}".
   *
   * For example to debug all mail sent by the user module by logging it to a
   * file, you might set the variable as something like:
+10 −10
Original line number Diff line number Diff line
@@ -133,18 +133,18 @@ public function testNumberFormatter() {
    $scale = rand(0, 10);

    $page = $this->getSession()->getPage();
    $page->pressButton("${float_field}_settings_edit");
    $page->pressButton("{$float_field}_settings_edit");
    $assert_session->waitForElement('css', '.ajax-new-content');
    $edit = [
      "fields[${float_field}][settings_edit_form][settings][prefix_suffix]" => TRUE,
      "fields[${float_field}][settings_edit_form][settings][scale]" => $scale,
      "fields[${float_field}][settings_edit_form][settings][decimal_separator]" => $decimal_separator,
      "fields[${float_field}][settings_edit_form][settings][thousand_separator]" => $thousand_separator,
      "fields[{$float_field}][settings_edit_form][settings][prefix_suffix]" => TRUE,
      "fields[{$float_field}][settings_edit_form][settings][scale]" => $scale,
      "fields[{$float_field}][settings_edit_form][settings][decimal_separator]" => $decimal_separator,
      "fields[{$float_field}][settings_edit_form][settings][thousand_separator]" => $thousand_separator,
    ];
    foreach ($edit as $name => $value) {
      $page->fillField($name, $value);
    }
    $page->pressButton("${float_field}_plugin_settings_update");
    $page->pressButton("{$float_field}_plugin_settings_update");
    $assert_session->waitForElement('css', '.field-plugin-summary-cell > .ajax-new-content');
    $this->submitForm([], 'Save');

@@ -165,16 +165,16 @@ public function testNumberFormatter() {
    $thousand_separator = $thousand_separators[array_rand($thousand_separators)];

    $page = $this->getSession()->getPage();
    $page->pressButton("${integer_field}_settings_edit");
    $page->pressButton("{$integer_field}_settings_edit");
    $assert_session->waitForElement('css', '.ajax-new-content');
    $edit = [
      "fields[${integer_field}][settings_edit_form][settings][prefix_suffix]" => FALSE,
      "fields[${integer_field}][settings_edit_form][settings][thousand_separator]" => $thousand_separator,
      "fields[{$integer_field}][settings_edit_form][settings][prefix_suffix]" => FALSE,
      "fields[{$integer_field}][settings_edit_form][settings][thousand_separator]" => $thousand_separator,
    ];
    foreach ($edit as $name => $value) {
      $page->fillField($name, $value);
    }
    $page->pressButton("${integer_field}_plugin_settings_update");
    $page->pressButton("{$integer_field}_plugin_settings_update");
    $assert_session->waitForElement('css', '.field-plugin-summary-cell > .ajax-new-content');
    $this->submitForm([], 'Save');

+1 −1
Original line number Diff line number Diff line
@@ -266,7 +266,7 @@ public function testLoggerException() {

    $expected_path = \Drupal::root() . '/core/modules/system/tests/modules/error_service_test/src/MonkeysInTheControlRoom.php';
    $expected_line = 62;
    $expected_entry = "Failed to log error: Exception: Deforestation in Drupal\\error_service_test\\MonkeysInTheControlRoom->handle() (line ${expected_line} of ${expected_path})";
    $expected_entry = "Failed to log error: Exception: Deforestation in Drupal\\error_service_test\\MonkeysInTheControlRoom->handle() (line {$expected_line} of {$expected_path})";
    $this->assertStringContainsString($expected_entry, $errors[0], 'Original error logged to the PHP error log when an exception is thrown by a logger');

    // The exception is expected. Do not interpret it as a test failure. Not
+3 −3
Original line number Diff line number Diff line
@@ -37,8 +37,8 @@ protected function findExtensionDirectories($root) {
   *   SubNamespace used to separate test suite. Examples: Unit, Functional.
   */
  protected function addTestsBySuiteNamespace($root, $suite_namespace) {
    // Core's tests are in the namespace Drupal\${suite_namespace}Tests\ and are
    // always inside of core/tests/Drupal/${suite_namespace}Tests. The exception
    // Core's tests are in the namespace Drupal\{$suite_namespace}Tests\ and are
    // always inside of core/tests/Drupal/{$suite_namespace}Tests. The exception
    // to this is Unit tests for historical reasons.
    if ($suite_namespace == 'Unit') {
      $tests = TestDiscovery::scanDirectory("Drupal\\Tests\\", "$root/core/tests/Drupal/Tests");
@@ -50,7 +50,7 @@ protected function addTestsBySuiteNamespace($root, $suite_namespace) {
      $this->addTestFiles($tests);
    }
    else {
      $this->addTestFiles(TestDiscovery::scanDirectory("Drupal\\${suite_namespace}Tests\\", "$root/core/tests/Drupal/${suite_namespace}Tests"));
      $this->addTestFiles(TestDiscovery::scanDirectory("Drupal\\{$suite_namespace}Tests\\", "$root/core/tests/Drupal/{$suite_namespace}Tests"));
    }

    // Extensions' tests will always be in the namespace