You are here

public function ChainedTamperTest::chainedTampersDataProvider in Tamper 8

Data provider for testChainedTampers().

File

tests/src/Kernel/ChainedTamperTest.php, line 77

Class

ChainedTamperTest
Tests chaining multiple tampers together.

Namespace

Drupal\Tests\tamper\Kernel

Code

public function chainedTampersDataProvider() {
  return [
    [
      'expected' => 'a|b|c',
      'input' => 'a,b,c',
      'tampers' => [
        [
          'plugin' => 'explode',
          'config' => [
            'separator' => ',',
          ],
        ],
        [
          'plugin' => 'implode',
          'config' => [
            'glue' => '|',
          ],
        ],
      ],
    ],
    [
      'expected' => NULL,
      'input' => 'a,b,c',
      'tampers' => [
        [
          'plugin' => 'explode',
          'config' => [
            'separator' => ',',
          ],
        ],
        [
          'plugin' => 'implode',
          'config' => [
            'glue' => '|',
          ],
        ],
        [
          'plugin' => 'implode',
          'config' => [
            'glue' => ';',
          ],
          'expected_exception' => TamperException::class,
        ],
      ],
    ],
    [
      'expected' => [
        [
          'a',
          'b',
          'c',
        ],
        [
          1,
          2,
        ],
      ],
      'input' => 'a,b,c;1,2',
      'tampers' => [
        [
          'plugin' => 'explode',
          'config' => [
            'separator' => ';',
          ],
        ],
        [
          'plugin' => 'explode',
          'config' => [
            'separator' => ',',
          ],
        ],
      ],
    ],
  ];
}