public function DiffEngineTest::testDiffInfiniteLoop in Drupal 10
Same name and namespace in other branches
- 8 core/tests/Drupal/Tests/Component/Diff/Engine/DiffEngineTest.php \Drupal\Tests\Component\Diff\Engine\DiffEngineTest::testDiffInfiniteLoop()
- 9 core/tests/Drupal/Tests/Component/Diff/Engine/DiffEngineTest.php \Drupal\Tests\Component\Diff\Engine\DiffEngineTest::testDiffInfiniteLoop()
Tests that two files can be successfully diffed.
@covers ::diff
File
- core/
tests/ Drupal/ Tests/ Component/ Diff/ Engine/ DiffEngineTest.php, line 94
Class
- DiffEngineTest
- Test DiffEngine class.
Namespace
Drupal\Tests\Component\Diff\EngineCode
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',
'',
]));
}