You are here

public function SqlsrvConditionTest::dataProviderForTestRegexp in Drupal driver for SQL Server and SQL Azure 3.0.x

Same name and namespace in other branches
  1. 8.2 tests/src/Unit/SqlsrvConditionTest.php \Drupal\Tests\sqlsrv\Unit\SqlsrvConditionTest::dataProviderForTestRegexp()
  2. 4.2.x tests/src/Unit/SqlsrvConditionTest.php \Drupal\Tests\sqlsrv\Unit\SqlsrvConditionTest::dataProviderForTestRegexp()
  3. 3.1.x tests/src/Unit/SqlsrvConditionTest.php \Drupal\Tests\sqlsrv\Unit\SqlsrvConditionTest::dataProviderForTestRegexp()
  4. 4.0.x tests/src/Unit/SqlsrvConditionTest.php \Drupal\Tests\sqlsrv\Unit\SqlsrvConditionTest::dataProviderForTestRegexp()
  5. 4.1.x tests/src/Unit/SqlsrvConditionTest.php \Drupal\Tests\sqlsrv\Unit\SqlsrvConditionTest::dataProviderForTestRegexp()

Provides a list of known operations and the expected output.

File

tests/src/Unit/SqlsrvConditionTest.php, line 123

Class

SqlsrvConditionTest
Test the behavior of the custom Condition class.

Namespace

Drupal\Tests\sqlsrv\Unit

Code

public function dataProviderForTestRegexp() {
  return [
    [
      '(REGEXP(:db_condition_placeholder_0, name) = 1)',
      'name',
      'REGEXP',
      '^P',
    ],
    [
      '(REGEXP(:db_condition_placeholder_0, name123) = 1)',
      'name-123',
      'REGEXP',
      's$',
    ],
    [
      '(REGEXP(:db_condition_placeholder_0, name) = 0)',
      'name',
      'NOT REGEXP',
      '^\\$[a-z][a-zA-Z_]$',
    ],
    [
      '(REGEXP(:db_condition_placeholder_0, name123) = 0)',
      'name-123',
      'NOT REGEXP',
      '^[a-z].*$',
    ],
  ];
}