function DiffEngineTest::testDiffInfiniteLoop
Same name in other branches
- 9 core/tests/Drupal/Tests/Component/Diff/Engine/DiffEngineTest.php \Drupal\Tests\Component\Diff\Engine\DiffEngineTest::testDiffInfiniteLoop()
- 8.9.x 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 119
Class
- DiffEngineTest
- Test DiffEngine class.
Namespace
Drupal\Tests\Component\Diff\EngineCode
public function testDiffInfiniteLoop() : void {
$this->expectDeprecation('Drupal\\Component\\Diff\\Engine\\DiffEngine is deprecated in drupal:10.1.0 and is removed from drupal:11.0.0. Use sebastianbergmann/diff instead. See https://www.drupal.org/node/3337942');
$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: random_hash_string_here',
]));
$this->assertEquals($diff[3], new DiffOpCopy([
'fallback_image_style: max_325x325',
'',
]));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.