You are here

public function DiffFormatterTest::provideTestDiff in Drupal 8

Same name and namespace in other branches
  1. 9 core/tests/Drupal/Tests/Component/Diff/DiffFormatterTest.php \Drupal\Tests\Component\Diff\DiffFormatterTest::provideTestDiff()

Return value

array

  • Expected formatted diff output.
  • First array of text to diff.
  • Second array of text to diff.

File

core/tests/Drupal/Tests/Component/Diff/DiffFormatterTest.php, line 24

Class

DiffFormatterTest
Test DiffFormatter classes.

Namespace

Drupal\Tests\Component\Diff

Code

public function provideTestDiff() {
  return [
    'empty' => [
      '',
      [],
      [],
    ],
    'add' => [
      "3a3\n> line2a\n",
      [
        'line1',
        'line2',
        'line3',
      ],
      [
        'line1',
        'line2',
        'line2a',
        'line3',
      ],
    ],
    'delete' => [
      "3d3\n< line2a\n",
      [
        'line1',
        'line2',
        'line2a',
        'line3',
      ],
      [
        'line1',
        'line2',
        'line3',
      ],
    ],
    'change' => [
      "3c3\n< line2a\n---\n> line2b\n",
      [
        'line1',
        'line2',
        'line2a',
        'line3',
      ],
      [
        'line1',
        'line2',
        'line2b',
        'line3',
      ],
    ],
  ];
}