Drupal 8  8.0.2
RendererTestBase Class Reference
Inheritance diagram for RendererTestBase:

Protected Member Functions

 setUp ()
 
 randomContextValue ()
 
 setUpUnusedCache ()
 
 setupMemoryCache ()
 
 setUpRequest ($method= 'GET')
 
 assertRenderCacheItem ($cid, $data, $bin= 'render')
 
- Protected Member Functions inherited from UnitTestCase
 setUp ()
 
 getRandomGenerator ()
 
 assertArrayEquals (array $expected, array $actual, $message=NULL)
 
 getBlockMockWithMachineName ($machine_name)
 
 getContainerWithCacheTagsInvalidator (CacheTagsInvalidatorInterface $cache_tags_validator)
 
 getClassResolverStub ()
 

Protected Attributes

 $renderer
 
 $renderCache
 
 $placeholderGenerator
 
 $requestStack
 
 $cacheFactory
 
 $cacheContexts
 
 $controllerResolver
 
 $themeManager
 
 $elementInfo
 
 $memoryCache
 
 $currentUserRole
 
 $rendererConfig
 
- Protected Attributes inherited from UnitTestCase
 $randomGenerator
 
 $root
 

Additional Inherited Members

- Public Member Functions inherited from UnitTestCase
 randomMachineName ($length=8)
 
 getConfigFactoryStub (array $configs=array())
 
 getConfigStorageStub (array $configs)
 
 getStringTranslationStub ()
 

Detailed Description

Base class for the actual unit tests testing .

Member Function Documentation

assertRenderCacheItem (   $cid,
  $data,
  $bin = 'render' 
)
protected

Asserts a render cache item.

Parameters
string$cidThe expected cache ID.
mixed$dataThe expected data for that cache ID.
string$binThe expected cache bin.

References Cache\mergeTags().

Referenced by RendererBubblingTest\testConditionalCacheContextBubblingSelfHealing(), RendererBubblingTest\testContextBubblingCustomCacheBin(), and RendererBubblingTest\testContextBubblingEdgeCases().

Here is the call graph for this function:

Here is the caller graph for this function:

randomContextValue ( )
protected

Generates a random context value for the placeholder tests.

The #context array used by the placeholder #lazy_builder callback will generally be used to provide metadata like entity IDs, field machine names, paths, etc. for JavaScript replacement of content or assets. In this test, the #lazy_builder callback PlaceholdersTest::callback() renders the context inside test HTML, so using any random string would sometimes cause random test failures because the test output would be unparseable. Instead, we provide random tokens for replacement.

See Also
PlaceholdersTest::callback()
https://www.drupal.org/node/2151609

Referenced by RendererTest\assertAccess(), RendererPlaceholdersTest\generatePlaceholderElement(), RendererPlaceholdersTest\providerPlaceholders(), RendererTest\providerTestRenderBasic(), and RendererPlaceholdersTest\testRecursivePlaceholder().

Here is the caller graph for this function:

setUp ( )
protected

{}

References Drupal\requestStack(), and Drupal\setContainer().

Here is the call graph for this function:

setUpUnusedCache ( )
protected

Sets up a render cache back-end that is asserted to be never used.

Referenced by RendererPlaceholdersTest\testCacheableParentWithPostRequest(), and RendererPlaceholdersTest\testUncacheableParent().

Here is the caller graph for this function:

Field Documentation

$rendererConfig
protected
Initial value:
= [
'required_cache_contexts' => [
'languages:language_interface',
'theme',
]

The documentation for this class was generated from the following file: