Drupal 8  8.0.2
UrlGeneratorTest Class Reference
Inheritance diagram for UrlGeneratorTest:

Public Member Functions

 aliasManagerCallback ()
 
 testAliasGeneration ()
 
 testGetPathFromRouteWithSubdirectory ()
 
 testAliasGenerationWithParameters ()
 
 testAliasGenerationWithOptions ($route_name, $route_parameters, $options, $expected)
 
 providerTestAliasGenerationWithOptions ()
 
 testGetPathFromRouteTrailing ()
 
 testAbsoluteURLGeneration ()
 
 testBaseURLGeneration ()
 
 testUrlGenerationWithHttpsRequirement ()
 
 testNoPath ($options, $expected_url)
 
 providerTestNoPath ()
 
- Public Member Functions inherited from UnitTestCase
 randomMachineName ($length=8)
 
 getConfigFactoryStub (array $configs=array())
 
 getConfigStorageStub (array $configs)
 
 getStringTranslationStub ()
 

Protected Member Functions

 setUp ()
 
 assertGenerateFromRoute ($route_name, array $route_parameters, array $options, $expected_url, BubbleableMetadata $expected_bubbleable_metadata)
 
- 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

 $generator
 
 $aliasManager
 
 $routeProcessorManager
 
 $requestStack
 
- Protected Attributes inherited from UnitTestCase
 $randomGenerator
 
 $root
 

Detailed Description

Confirm that the UrlGenerator is functioning properly.

Routing

Member Function Documentation

aliasManagerCallback ( )

Return value callback for the getAliasByPath() method on the mock alias manager.

Ensures that by default the call to getAliasByPath() will return the first argument that was passed in. We special-case the paths for which we wish it to return an actual alias.

Returns
string
assertGenerateFromRoute (   $route_name,
array  $route_parameters,
array  $options,
  $expected_url,
BubbleableMetadata  $expected_bubbleable_metadata 
)
protected

Asserts ::generateFromRoute()'s output.

Parameters
$route_nameThe route name to test.
array$route_parametersThe route parameters to test.
array$optionsThe options to test.
$expected_urlThe expected generated URL string.
\Drupal\Core\Render\BubbleableMetadata$expected_bubbleable_metadataThe expected generated bubbleable metadata.

References BubbleableMetadata\createFromObject().

Referenced by UrlGeneratorTest\testAbsoluteURLGeneration(), UrlGeneratorTest\testAliasGeneration(), UrlGeneratorTest\testAliasGenerationWithOptions(), UrlGeneratorTest\testAliasGenerationWithParameters(), UrlGeneratorTest\testBaseURLGeneration(), and UrlGeneratorTest\testUrlGenerationWithHttpsRequirement().

Here is the call graph for this function:

Here is the caller graph for this function:

providerTestAliasGenerationWithOptions ( )

Provides test data for testAliasGenerationWithOptions.

providerTestNoPath ( )

Data provider for ::testNoPath().

setUp ( )
protected

{}

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

Here is the call graph for this function:

testAbsoluteURLGeneration ( )

Confirms that absolute URLs work with generated routes.

References UrlGeneratorTest\assertGenerateFromRoute(), and Cache\PERMANENT.

Here is the call graph for this function:

testAliasGeneration ( )

Confirms that generated routes will have aliased paths.

References UrlGeneratorTest\assertGenerateFromRoute(), and Cache\PERMANENT.

Here is the call graph for this function:

testAliasGenerationWithOptions (   $route_name,
  $route_parameters,
  $options,
  $expected 
)

Confirms that generated routes will have aliased paths with options.

providerTestAliasGenerationWithOptions

References UrlGeneratorTest\assertGenerateFromRoute(), and Cache\PERMANENT.

Here is the call graph for this function:

testAliasGenerationWithParameters ( )

Confirms that generated routes will have aliased paths.

References UrlGeneratorTest\assertGenerateFromRoute(), and Cache\PERMANENT.

Here is the call graph for this function:

testBaseURLGeneration ( )

Confirms that explicitly setting the base_url works with generated routes

References UrlGeneratorTest\assertGenerateFromRoute(), and Cache\PERMANENT.

Here is the call graph for this function:

testGetPathFromRouteTrailing ( )

Tests URL generation from route with trailing start and end slashes.

testGetPathFromRouteWithSubdirectory ( )

Tests URL generation in a subdirectory.

testNoPath (   $options,
  $expected_url 
)

Tests generating a relative URL with no path.

Parameters
array$optionsAn array of URL options.
string$expected_urlThe expected relative URL.

::generateFromRoute

providerTestNoPath

testUrlGenerationWithHttpsRequirement ( )

Test that the 'scheme' route requirement is respected during url generation.

References UrlGeneratorTest\assertGenerateFromRoute(), and Cache\PERMANENT.

Here is the call graph for this function:


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