X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=web%2Fcore%2Ftests%2FDrupal%2FTests%2FComponent%2FDiff%2FEngine%2FDiffEngineTest.php;fp=web%2Fcore%2Ftests%2FDrupal%2FTests%2FComponent%2FDiff%2FEngine%2FDiffEngineTest.php;h=1714e663be55a4499d5c12f407b8d01c34c61719;hp=69f92daec9c79932f224b993f7e824a957839492;hb=af6d1fb995500ae68849458ee10d66abbdcfb252;hpb=680c79a86e3ed402f263faeac92e89fb6d9edcc0 diff --git a/web/core/tests/Drupal/Tests/Component/Diff/Engine/DiffEngineTest.php b/web/core/tests/Drupal/Tests/Component/Diff/Engine/DiffEngineTest.php index 69f92daec..1714e663b 100644 --- a/web/core/tests/Drupal/Tests/Component/Diff/Engine/DiffEngineTest.php +++ b/web/core/tests/Drupal/Tests/Component/Diff/Engine/DiffEngineTest.php @@ -86,4 +86,21 @@ class DiffEngineTest extends TestCase { } } + /** + * Tests that two files can be successfully diffed. + * + * @covers ::diff + */ + public function testDiffInfiniteLoop() { + $from = explode("\n", file_get_contents(__DIR__ . '/fixtures/file1.txt')); + $to = explode("\n", file_get_contents(__DIR__ . '/fixtures/file2.txt')); + $diff_engine = new DiffEngine(); + $diff = $diff_engine->diff($from, $to); + $this->assertCount(4, $diff); + $this->assertEquals($diff[0], new DiffOpDelete([' - image.style.max_650x650'])); + $this->assertEquals($diff[1], new DiffOpCopy([' - image.style.max_325x325'])); + $this->assertEquals($diff[2], new DiffOpAdd([' - image.style.max_650x650', '_core:', ' default_config_hash: 3mjM9p-kQ8syzH7N8T0L9OnCJDSPvHAZoi3q6jcXJKM'])); + $this->assertEquals($diff[3], new DiffOpCopy(['fallback_image_style: max_325x325', ''])); + } + }