function PageContextTest::entityLabelProvider
Data provider for entity label scenarios.
Return value
array [label_return_value, expected]
File
-
core/
modules/ navigation/ tests/ src/ Unit/ PageContextTest.php, line 112
Class
- PageContextTest
- Tests the PageContext Top Bar item build output.
Namespace
Drupal\Tests\navigation\UnitCode
public static function entityLabelProvider() : array {
$stringable = new class implements \Stringable {
/**
* Dummy string method.
*
* @return string
* The dummy entity label.
*/
public function __toString() : string {
return 'Stringable Label';
}
};
return [
'string' => [
'My Label',
'My Label',
],
'stringable' => [
$stringable,
'Stringable Label',
],
'render_array' => [
[
'#markup' => 'Rendered Label',
],
NULL,
],
'invalid' => [
new \stdClass(),
NULL,
],
];
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.