Update to Drupal 8.2.4. For more information, see https://www.drupal.org/project/drupal/releases/8.2.4
This commit is contained in:
parent
0a95b8440e
commit
8544b60b39
284 changed files with 12980 additions and 3199 deletions
57
core/tests/Drupal/Tests/Component/Diff/DiffFormatterTest.php
Normal file
57
core/tests/Drupal/Tests/Component/Diff/DiffFormatterTest.php
Normal file
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
Reference in a new issue