public function OgGroupContextCacheContextTest::contextProvider in Organic groups 8
Provides test data for the test with active context objects.
Return value
array An array of test data arrays, each array having two elements: 1. The test data that is used to set up the active context. 2. The cache context string that is expected to be returned by the cache context service being tested.
Overrides OgContextCacheContextTestBase::contextProvider
See also
::testWithContext()
File
- tests/
src/ Unit/ Cache/ Context/ OgGroupContextCacheContextTest.php, line 57
Class
- OgGroupContextCacheContextTest
- Tests the OG group context cache context.
Namespace
Drupal\Tests\og\Unit\Cache\ContextCode
public function contextProvider() {
return [
// Test the expected result if no valid group exists in the active
// context.
[
FALSE,
OgGroupContextCacheContext::NO_CONTEXT,
],
// Test having an entity with a numeric ID present in the active context.
[
[
'entity_type' => 'node',
'id' => 3,
],
'node:3',
],
// Test having an entity with a string ID present in the active context.
[
[
'entity_type' => 'entity_test',
'id' => 'Shibo Yangcong-San',
],
'entity_test:Shibo Yangcong-San',
],
];
}