You are here

public function WebformYamlTest::providerEncode in Webform 8.5

Same name and namespace in other branches
  1. 6.x tests/src/Unit/Utility/WebformYamlTest.php \Drupal\Tests\webform\Unit\Utility\WebformYamlTest::providerEncode()

Data provider for testEncode().

See also

testEncode()

File

tests/src/Unit/Utility/WebformYamlTest.php, line 152

Class

WebformYamlTest
Tests webform tidy utility.

Namespace

Drupal\Tests\webform\Unit\Utility

Code

public function providerEncode() {
  $tests[] = [
    [
      'simple' => 'value',
    ],
    "simple: value",
  ];
  $tests[] = [
    [
      'returns' => "line 1\nline 2",
    ],
    "returns: |\n  line 1\n  line 2",
  ];
  $tests[] = [
    [
      'one two' => "line 1\nline 2",
    ],
    "'one two': |\n  line 1\n  line 2",
  ];
  $tests[] = [
    [
      'array' => [
        'one',
        'two',
      ],
    ],
    "array:\n  - one\n  - two",
  ];
  $tests[] = [
    [
      [
        'one' => 'One',
      ],
      [
        'two' => 'Two',
      ],
    ],
    "- one: One\n- two: Two",
  ];
  $tests[] = [
    [],
    '',
  ];
  $tests[] = [
    '',
    "''",
  ];
  $tests[] = [
    0,
    '0',
  ];
  return $tests;
}