public function FieldItemListTest::providerTestEquals in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/tests/Drupal/Tests/Core/Field/FieldItemListTest.php \Drupal\Tests\Core\Field\FieldItemListTest::providerTestEquals()
Data provider for testEquals.
File
- core/
tests/ Drupal/ Tests/ Core/ Field/ FieldItemListTest.php, line 67 - Contains \Drupal\Tests\Core\Field\FieldItemListTest.
Class
- FieldItemListTest
- @coversDefaultClass \Drupal\Core\Field\FieldItemList @group Field
Namespace
Drupal\Tests\Core\FieldCode
public function providerTestEquals() {
// Tests field item lists with no values.
$datasets[] = [
TRUE,
];
/** @var \Drupal\Core\Field\FieldItemBase $field_item_a */
$field_item_a = $this
->getMockForAbstractClass('Drupal\\Core\\Field\\FieldItemBase', [], '', FALSE);
$field_item_a
->setValue([
1,
]);
// Tests field item lists where one has a value and one does not.
$datasets[] = [
FALSE,
$field_item_a,
];
// Tests field item lists where both have the same value.
$datasets[] = [
TRUE,
$field_item_a,
$field_item_a,
];
/** @var \Drupal\Core\Field\FieldItemBase $fv */
$field_item_b = $this
->getMockForAbstractClass('Drupal\\Core\\Field\\FieldItemBase', [], '', FALSE);
$field_item_b
->setValue([
2,
]);
// Tests field item lists where both have the different values.
$datasets[] = [
FALSE,
$field_item_a,
$field_item_b,
];
/** @var \Drupal\Core\Field\FieldItemBase $fv */
$field_item_c = $this
->getMockForAbstractClass('Drupal\\Core\\Field\\FieldItemBase', [], '', FALSE);
$field_item_c
->setValue([
'0' => 1,
'1' => 2,
]);
$field_item_d = $this
->getMockForAbstractClass('Drupal\\Core\\Field\\FieldItemBase', [], '', FALSE);
$field_item_d
->setValue([
'1' => 2,
'0' => 1,
]);
// Tests field item lists where both have the differently ordered values.
$datasets[] = [
TRUE,
$field_item_c,
$field_item_d,
];
/** @var \Drupal\Core\Field\FieldItemBase $field_item_e */
$field_item_e = $this
->getMockForAbstractClass('Drupal\\Core\\Field\\FieldItemBase', [], '', FALSE);
$field_item_e
->setValue([
'2',
]);
// Tests field item lists where both have same values but different data
// types.
$datasets[] = [
TRUE,
$field_item_b,
$field_item_e,
];
return $datasets;
}