You are here

public function ConnectionTest::providerEscapeFields in Drupal 9

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 555

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',
      [
        '[',
        ']',
      ],
    ],
  ];
}