function SubstrTest::providerTestSubstr

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()
  2. 8.9.x core/modules/migrate/tests/src/Unit/process/SubstrTest.php \Drupal\Tests\migrate\Unit\process\SubstrTest::providerTestSubstr()
  3. 11.x 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 44

Class

SubstrTest
Tests the substr plugin.

Namespace

Drupal\Tests\migrate\Unit\process

Code

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

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