function ConnectionTest::providerEscapeFields

Same name in other branches
  1. 9 core/tests/Drupal/Tests/Core/Database/ConnectionTest.php \Drupal\Tests\Core\Database\ConnectionTest::providerEscapeFields()
  2. 11.x 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 525

Class

ConnectionTest
Tests the Connection class.

Namespace

Drupal\Tests\Core\Database

Code

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

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.