diff --git a/core/lib/Drupal/Component/Diff/DiffFormatter.php b/core/lib/Drupal/Component/Diff/DiffFormatter.php
index ce08b004dc8c835667df0fdbe1a6e1542f80b1d2..edcb84df78f6f279cce7a8865c2d25f563dc3109 100644
--- a/core/lib/Drupal/Component/Diff/DiffFormatter.php
+++ b/core/lib/Drupal/Component/Diff/DiffFormatter.php
@@ -36,6 +36,16 @@ class DiffFormatter {
    */
   public $trailing_context_lines = 0;
 
+  /**
+   * The line stats.
+   *
+   * @var array
+   */
+  protected $line_stats = array(
+    'counter' => array('x' => 0, 'y' => 0),
+    'offset' => array('x' => 0, 'y' => 0),
+  );
+
   /**
    * Format a diff.
    *
diff --git a/core/lib/Drupal/Core/Diff/DiffFormatter.php b/core/lib/Drupal/Core/Diff/DiffFormatter.php
index 52f28949179b4eda912c49c1e5917032d88191e0..8ebe2f4793db534ba2c010f4beabbac125b9ced2 100644
--- a/core/lib/Drupal/Core/Diff/DiffFormatter.php
+++ b/core/lib/Drupal/Core/Diff/DiffFormatter.php
@@ -19,16 +19,6 @@ class DiffFormatter extends DiffFormatterBase {
    */
   protected $rows = array();
 
-  /**
-   * The line stats.
-   *
-   * @var array
-   */
-  protected $line_stats = array(
-    'counter' => array('x' => 0, 'y' => 0),
-    'offset' => array('x' => 0, 'y' => 0),
-  );
-
   /**
    * Creates a DiffFormatter to render diffs in a table.
    *
diff --git a/core/tests/Drupal/Tests/Component/Diff/DiffFormatterTest.php b/core/tests/Drupal/Tests/Component/Diff/DiffFormatterTest.php
new file mode 100644
index 0000000000000000000000000000000000000000..70fb0dcf155a4266f502dac84234f1e2aca4bdcc
--- /dev/null
+++ b/core/tests/Drupal/Tests/Component/Diff/DiffFormatterTest.php
@@ -0,0 +1,57 @@
+<?php
+
+namespace Drupal\Tests\Component\Diff;
+
+use Drupal\Component\Diff\Diff;
+use Drupal\Component\Diff\DiffFormatter;
+
+/**
+ * Test DiffFormatter classes.
+ *
+ * @coversDefaultClass \Drupal\Component\Diff\DiffFormatter
+ *
+ * @group Diff
+ */
+class DiffFormatterTest extends \PHPUnit_Framework_TestCase {
+
+  /**
+   * @return array
+   *   - Expected formatted diff output.
+   *   - First array of text to diff.
+   *   - Second array of text to diff.
+   */
+  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'],
+      ],
+    ];
+  }
+
+  /**
+   * Tests whether op classes returned by DiffEngine::diff() match expectations.
+   *
+   * @covers ::format
+   * @dataProvider provideTestDiff
+   */
+  public function testDiff($expected, $from, $to) {
+    $diff = new Diff($from, $to);
+    $formatter = new DiffFormatter();
+    $output = $formatter->format($diff);
+    $this->assertEquals($expected, $output);
+  }
+
+}