You are here

public function SubstrTest::providerTestSubstr in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/migrate/tests/src/Unit/process/SubstrTest.php \Drupal\Tests\migrate\Unit\process\SubstrTest::providerTestSubstr()

Data provider for testSubstr().

File

core/modules/migrate/tests/src/Unit/process/SubstrTest.php, line 40

Class

SubstrTest
Tests the substr plugin.

Namespace

Drupal\Tests\migrate\Unit\process

Code

public function providerTestSubstr() {
  return [
    // Tests with valid start and length values.
    [
      0,
      7,
      'Captain',
    ],
    // Tests with valid start > 0 and valid length.
    [
      6,
      3,
      'n J',
    ],
    // Tests with valid start < 0 and valid length.
    [
      -7,
      4,
      'Jane',
    ],
    // Tests without start value and valid length value.
    [
      NULL,
      7,
      'Captain',
    ],
    // Tests with valid start value and no length value.
    [
      1,
      NULL,
      'aptain Janeway',
    ],
    // Tests without both start and length values.
    [
      NULL,
      NULL,
      'Captain Janeway',
    ],
  ];
}