public function DefaultFieldComparatorTest::testMultipleFieldValuesDeletion in Changed Fields API 8.3
Same name and namespace in other branches
- 8.2 tests/src/Unit/DefaultFieldComparatorTest.php \Drupal\Tests\changed_fields\Unit\DefaultFieldComparatorTest::testMultipleFieldValuesDeletion()
Check comparison of multi-value fields - delete a field value.
File
- tests/
src/ Unit/ DefaultFieldComparatorTest.php, line 498
Class
- DefaultFieldComparatorTest
- @coversDefaultClass \Drupal\changed_fields\Plugin\FieldComparator\DefaultFieldComparator
Namespace
Drupal\Tests\changed_fields\UnitCode
public function testMultipleFieldValuesDeletion() {
$this->fieldDefinitionMock
->expects($this
->once())
->method('getType')
->willReturn('string');
$this
->assertArrayEquals([
'old_value' => [
[
'value' => 'Text 1',
],
[
'value' => 'Text 2',
],
],
'new_value' => [
[
'value' => 'Text 2',
],
],
], $this->fieldComparator
->compareFieldValues($this->fieldDefinitionMock, [
[
'value' => 'Text 1',
],
[
'value' => 'Text 2',
],
], [
[
'value' => 'Text 2',
],
]));
}