You are here

public function DiffFormatterTest::testDiff 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::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);
}