function DiffEngineTest::testDiff
Same name in other branches
- 9 core/tests/Drupal/Tests/Component/Diff/Engine/DiffEngineTest.php \Drupal\Tests\Component\Diff\Engine\DiffEngineTest::testDiff()
- 10 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->assertCount(count($expected), $diff);
// Make sure the diff objects match our expectations.
foreach ($expected as $index => $op_class) {
$this->assertEquals($op_class, get_class($diff[$index]));
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.