function EntityReferenceSelectionReferenceableTest::providerTestCases
Same name in other branches
- 8.9.x core/modules/system/tests/src/Kernel/Entity/EntityReferenceSelectionReferenceableTest.php \Drupal\Tests\system\Kernel\Entity\EntityReferenceSelectionReferenceableTest::providerTestCases()
- 10 core/modules/system/tests/src/Kernel/Entity/EntityReferenceSelectionReferenceableTest.php \Drupal\Tests\system\Kernel\Entity\EntityReferenceSelectionReferenceableTest::providerTestCases()
- 11.x core/modules/system/tests/src/Kernel/Entity/EntityReferenceSelectionReferenceableTest.php \Drupal\Tests\system\Kernel\Entity\EntityReferenceSelectionReferenceableTest::providerTestCases()
Provides test cases for ::testReferenceablesWithNoLabelKey() test.
Return value
array[]
File
-
core/
modules/ system/ tests/ src/ Kernel/ Entity/ EntityReferenceSelectionReferenceableTest.php, line 142
Class
- EntityReferenceSelectionReferenceableTest
- Tests entity reference selection plugins.
Namespace
Drupal\Tests\system\Kernel\EntityCode
public function providerTestCases() {
return [
// All referenceables, no limit. Expecting 9 items.
[
NULL,
'CONTAINS',
0,
9,
static::$labels,
9,
],
// Referenceables containing 'w', no limit. Expecting no item.
[
'w',
'CONTAINS',
0,
0,
[],
0,
],
// Referenceables starting with 'w', no limit. Expecting no item.
[
'w',
'STARTS_WITH',
0,
0,
[],
0,
],
// Referenceables containing 'ab', no limit. Expecting 2 items ('abc',
// 'xyabz').
[
'ab',
'CONTAINS',
0,
2,
[
'abc',
'xyabz_',
],
2,
],
// Referenceables starting with 'A', no limit. Expecting 1 item ('abc').
[
'A',
'STARTS_WITH',
0,
1,
[
'abc',
],
1,
],
// Referenceables containing '_', limited to 3. Expecting 3 limited items
// ('Xyz_', 'xyabz_', 'foo_') and 5 total.
[
'_',
'CONTAINS',
3,
3,
[
'Xyz_',
'xyabz_',
'foo_',
],
6,
],
// Referenceables ending with 'z_', limited to 3. Expecting 3 limited
// items ('Xyz_', 'xyabz_', 'baz_') and 4 total.
[
'z_',
'ENDS_WITH',
3,
3,
[
'Xyz_',
'xyabz_',
'baz_',
],
4,
],
// Referenceables identical with 'xyabz_', no limit. Expecting 1 item
// ('xyabz_').
[
'xyabz_',
'=',
0,
1,
[
'xyabz_',
],
1,
],
// Referenceables greater than 'foo', no limit. Expecting 4 items ('Xyz_',
// 'xyabz_', 'foo_', 'șz_').
[
'foo',
'>',
0,
4,
[
'Xyz_',
'xyabz_',
'foo_',
'șz_',
],
4,
],
// Referenceables greater or identical with 'baz_', no limit. Expecting 5
// items ('Xyz_', 'xyabz_', 'foo_', 'baz_', 'șz_').
[
'baz_',
'>=',
0,
5,
[
'Xyz_',
'xyabz_',
'foo_',
'baz_',
'șz_',
],
5,
],
// Referenceables less than 'foo', no limit. Expecting 5 items ('abc',
// 'bar_', 'baz_', NULL, '<strong>').
[
'foo',
'<',
0,
5,
[
'abc',
'bar_',
'baz_',
NULL,
'<strong>',
],
5,
],
// Referenceables less or identical with 'baz_', no limit. Expecting 5
// items ('abc', 'bar_', 'baz_', NULL, '<strong>').
[
'baz_',
'<=',
0,
5,
[
'abc',
'bar_',
'baz_',
NULL,
'<strong>',
],
5,
],
// Referenceables not identical with 'baz_', no limit. Expecting 7 items
// ('abc', 'Xyz_', 'xyabz_', 'foo_', 'bar_', 'șz_', NULL, '<strong>').
[
'baz_',
'<>',
0,
8,
[
'abc',
'Xyz_',
'xyabz_',
'foo_',
'bar_',
'șz_',
NULL,
'<strong>',
],
8,
],
// Referenceables in ('bar_', 'baz_'), no limit. Expecting 2 items
// ('bar_', 'baz_')
[
[
'bar_',
'baz_',
],
'IN',
0,
2,
[
'bar_',
'baz_',
],
2,
],
// Referenceables not in ('bar_', 'baz_'), no limit. Expecting 6 items
// ('abc', 'Xyz_', 'xyabz_', 'foo_', 'șz_', NULL, '<strong>')
[
[
'bar_',
'baz_',
],
'NOT IN',
0,
7,
[
'abc',
'Xyz_',
'xyabz_',
'foo_',
'șz_',
NULL,
'<strong>',
],
7,
],
// Referenceables not null, no limit. Expecting 9 items ('abc', 'Xyz_',
// 'xyabz_', 'foo_', 'bar_', 'baz_', 'șz_', NULL, '<strong>').
//
// Note: Even we set the name as NULL, when retrieving the label from the
// entity we'll get an empty string, meaning that this match operator
// will return TRUE every time.
[
NULL,
'IS NOT NULL',
0,
9,
static::$labels,
9,
],
// Referenceables null, no limit. Expecting 9 items ('abc', 'Xyz_',
// 'xyabz_', 'foo_', 'bar_', 'baz_', 'șz_', NULL, '<strong>').
//
// Note: Even we set the name as NULL, when retrieving the label from the
// entity we'll get an empty string, meaning that this match operator
// will return FALSE every time.
[
NULL,
'IS NULL',
0,
9,
static::$labels,
9,
],
// Referenceables containing '<strong>' markup, no limit. Expecting 1 item
// ('<strong>').
[
'<strong>',
'CONTAINS',
0,
1,
[
'<strong>',
],
1,
],
// Test an unsupported operator. We expect no items.
[
'abc',
'*unsupported*',
0,
0,
[],
0,
],
];
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.