class HWLDFWordAccumulatorTest
Same name in other branches
- 9 core/tests/Drupal/Tests/Component/Diff/Engine/HWLDFWordAccumulatorTest.php \Drupal\Tests\Component\Diff\Engine\HWLDFWordAccumulatorTest
- 10 core/tests/Drupal/Tests/Component/Diff/Engine/HWLDFWordAccumulatorTest.php \Drupal\Tests\Component\Diff\Engine\HWLDFWordAccumulatorTest
- 11.x core/tests/Drupal/Tests/Component/Diff/Engine/HWLDFWordAccumulatorTest.php \Drupal\Tests\Component\Diff\Engine\HWLDFWordAccumulatorTest
Test HWLDFWordAccumulator.
@coversDefaultClass \Drupal\Component\Diff\Engine\HWLDFWordAccumulator
@group Diff
Hierarchy
- class \Drupal\Tests\Component\Diff\Engine\HWLDFWordAccumulatorTest extends \PHPUnit\Framework\TestCase
Expanded class hierarchy of HWLDFWordAccumulatorTest
File
-
core/
tests/ Drupal/ Tests/ Component/ Diff/ Engine/ HWLDFWordAccumulatorTest.php, line 15
Namespace
Drupal\Tests\Component\Diff\EngineView source
class HWLDFWordAccumulatorTest extends TestCase {
/**
* Verify that we only get back a NBSP from an empty accumulator.
*
* @covers ::getLines
*
* @see Drupal\Component\Diff\Engine\HWLDFWordAccumulator::NBSP
*/
public function testGetLinesEmpty() {
$acc = new HWLDFWordAccumulator();
$this->assertEquals([
' ',
], $acc->getLines());
}
/**
* @return array
* - Expected array of lines from getLines().
* - Array of strings for the $words parameter to addWords().
* - String tag for the $tag parameter to addWords().
*/
public function provideAddWords() {
return [
[
[
'wordword2',
],
[
'word',
'word2',
],
'tag',
],
[
[
'word',
'word2',
],
[
'word',
"\nword2",
],
'tag',
],
[
[
' ',
'word2',
],
[
'',
"\nword2",
],
'tag',
],
];
}
/**
* @covers ::addWords
* @dataProvider provideAddWords
*/
public function testAddWords($expected, $words, $tag) {
$acc = new HWLDFWordAccumulator();
$acc->addWords($words, $tag);
$this->assertEquals($expected, $acc->getLines());
}
}
Members
Title Sort descending | Modifiers | Object type | Summary |
---|---|---|---|
HWLDFWordAccumulatorTest::provideAddWords | public | function | |
HWLDFWordAccumulatorTest::testAddWords | public | function | @covers ::addWords @dataProvider provideAddWords |
HWLDFWordAccumulatorTest::testGetLinesEmpty | public | function | Verify that we only get back a NBSP from an empty accumulator. |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.