public function DiffEngineTest::testDiff in Drupal 9
Same name and namespace in other branches
- 8 core/tests/Drupal/Tests/Component/Diff/Engine/DiffEngineTest.php \Drupal\Tests\Component\Diff\Engine\DiffEngineTest::testDiff()
Tests whether op classes returned by DiffEngine::diff() match expectations.
@covers ::diff @dataProvider provideTestDiff
File
- core/
tests/ Drupal/ Tests/ Component/ Diff/ Engine/ DiffEngineTest.php, line 78
Class
- DiffEngineTest
- Test DiffEngine class.
Namespace
Drupal\Tests\Component\Diff\EngineCode
public function testDiff($expected, $from, $to) {
$diff_engine = new DiffEngine();
$diff = $diff_engine
->diff($from, $to);
// Make sure we have the same number of results as expected.
$this
->assertSameSize($expected, $diff);
// Make sure the diff objects match our expectations.
foreach ($expected as $index => $op_class) {
$this
->assertEquals($op_class, get_class($diff[$index]));
}
}