Drupal 8 8.0.2
|testBuildCacheability ($description, $tree, $expected_build, $access, array $access_cache_contexts=)|
|Public Member Functions inherited from UnitTestCase|
|getConfigFactoryStub (array $configs=array())|
|getConfigStorageStub (array $configs)|
|Protected Member Functions inherited from UnitTestCase|
|assertArrayEquals (array $expected, array $actual, $message=NULL)|
|getContainerWithCacheTagsInvalidator (CacheTagsInvalidatorInterface $cache_tags_validator)|
|Protected Attributes inherited from UnitTestCase|
Provides the test cases to test for ::testBuildCacheability().
As explained in the documentation for ::testBuildCacheability(), this generates 1 + (3 * 2 * 3) = 19 test cases.
MenuLinkTree::build() gathers both:
Finally, there are four important shapes of trees, all of which we want to test:
The associated data provider aims to test the handling of both of these types of cacheability, and for all four tree shapes, for each of the types of values for the two types of cacheability.
There is another level of cacheability involved when actually rendering built menu trees (i.e. when invoking RendererInterface::render() on the return value of MenuLinkTreeInterface::build()): the cacheability of the generated URLs. Fortunately, that doesn't need additional test coverage here because that cacheability is handled at the level of the Renderer (i.e. menu.html.twig template's link() function invocation). It also has its own test coverage.