You are here

public function ConnectionTest::providerEscapeFields in Drupal 10

Same name and namespace in other branches
  1. 9 core/tests/Drupal/Tests/Core/Database/ConnectionTest.php \Drupal\Tests\Core\Database\ConnectionTest::providerEscapeFields()

Data provider for testEscapeField.

Return value

array Array of arrays with the following elements:

  • Expected escaped string.
  • String to escape.

File

core/tests/Drupal/Tests/Core/Database/ConnectionTest.php, line 506

Class

ConnectionTest
Tests the Connection class.

Namespace

Drupal\Tests\Core\Database

Code

public function providerEscapeFields() {
  return [
    [
      '/title/',
      'title',
      [
        '/',
        '/',
      ],
    ],
    [
      '`backtick`',
      'backtick',
      [
        '`',
        '`',
      ],
    ],
    [
      'test.title',
      'test.title',
      [
        '',
        '',
      ],
    ],
    [
      '"isDefaultRevision"',
      'isDefaultRevision',
    ],
    [
      '"isDefaultRevision"',
      '"isDefaultRevision"',
    ],
    [
      '"entity_test"."isDefaultRevision"',
      'entity_test.isDefaultRevision',
    ],
    [
      '"entity_test"."isDefaultRevision"',
      '"entity_test"."isDefaultRevision"',
    ],
    [
      '"entityTest"."isDefaultRevision"',
      '"entityTest"."isDefaultRevision"',
    ],
    [
      '"entityTest"."isDefaultRevision"',
      'entityTest.isDefaultRevision',
    ],
    [
      '[entityTest].[isDefaultRevision]',
      'entityTest.isDefaultRevision',
      [
        '[',
        ']',
      ],
    ],
  ];
}