function DiffFormatterTest::testDiff

Same name in other branches
  1. 9 core/tests/Drupal/Tests/Component/Diff/DiffFormatterTest.php \Drupal\Tests\Component\Diff\DiffFormatterTest::testDiff()
  2. 10 core/tests/Drupal/Tests/Component/Diff/DiffFormatterTest.php \Drupal\Tests\Component\Diff\DiffFormatterTest::testDiff()
  3. 11.x core/tests/Drupal/Tests/Component/Diff/DiffFormatterTest.php \Drupal\Tests\Component\Diff\DiffFormatterTest::testDiff()

Tests whether op classes returned by DiffEngine::diff() match expectations.

@covers ::format @dataProvider provideTestDiff

File

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

Class

DiffFormatterTest
Test DiffFormatter classes.

Namespace

Drupal\Tests\Component\Diff

Code

public function testDiff($expected, $from, $to) {
    $diff = new Diff($from, $to);
    $formatter = new DiffFormatter();
    $output = $formatter->format($diff);
    $this->assertEquals($expected, $output);
}

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