Drupal 8  8.0.2
FormBuilderTest Class Reference
Inheritance diagram for FormBuilderTest:

Public Member Functions

 testGetFormIdWithString ()
 
 testGetFormIdWithClassName ()
 
 testGetFormIdWithInjectedClassName ()
 
 testGetFormIdWithObject ()
 
 testGetFormIdWithBaseForm ()
 
 testHandleFormStateResponse ($class, $form_state_key)
 
 formStateResponseProvider ()
 
 testHandleRedirectWithResponse ()
 
 testGetFormWithString ()
 
 testGetFormWithObject ()
 
 testGetFormWithClassString ()
 
 testBuildFormWithString ()
 
 testBuildFormWithClassString ()
 
 testBuildFormWithObject ()
 
 testBuildFormWithTriggeringElement ($element_value, $input_value)
 
 providerTestBuildFormWithTriggeringElement ()
 
 testRebuildForm ()
 
 testRebuildFormOnGetRequest ()
 
 testGetCache ()
 
 testUniqueHtmlId ()
 
 testFormCacheDeletionCached ()
 
 testFormCacheDeletionUncached ()
 
 testExceededFileSize ()
 
 testChildAccessInheritance ($element, $access_checks)
 
 providerTestChildAccessInheritance ()
 
 testValueCallableIsSafe ($callback, $expected)
 
 providerTestValueCallableIsSafe ()
 
 testInvalidToken ($expected, $valid_token, $user_is_authenticated)
 
 providerTestInvalidToken ()
 
 testFormTokenCacheability ($token, $is_authenticated, $expected_form_cacheability, $expected_token_cacheability, $method)
 
 providerTestFormTokenCacheability ()
 
- Public Member Functions inherited from FormTestBase
 getInfo ($type)
 
- Public Member Functions inherited from UnitTestCase
 randomMachineName ($length=8)
 
 getConfigFactoryStub (array $configs=array())
 
 getConfigStorageStub (array $configs)
 
 getStringTranslationStub ()
 

Protected Member Functions

 setUp ()
 
- Protected Member Functions inherited from FormTestBase
 setUp ()
 
 tearDown ()
 
 getMockForm ($form_id, $expected_form=NULL, $count=1)
 
 simulateFormSubmission ($form_id, FormInterface $form_arg, FormStateInterface $form_state, $programmed=TRUE)
 
 assertFormElement (array $expected_form, array $actual_form, $form_key=NULL)
 
- 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

 $container
 
- Protected Attributes inherited from FormTestBase
 $formBuilder
 
 $formValidator
 
 $formSubmitter
 
 $urlGenerator
 
 $moduleHandler
 
 $formCache
 
 $cache
 
 $account
 
 $controllerResolver
 
 $csrfToken
 
 $request
 
 $requestStack
 
 $classResolver
 
 $elementInfo
 
 $eventDispatcher
 
 $translationManager
 
 $kernel
 
 $logger
 
 $themeManager
 
- Protected Attributes inherited from UnitTestCase
 $randomGenerator
 
 $root
 

Detailed Description

Form

Member Function Documentation

formStateResponseProvider ( )

Provides test data for testHandleFormStateResponse().

providerTestBuildFormWithTriggeringElement ( )

Data provider for ::testBuildFormWithTriggeringElement().

References Html\escape().

Here is the call graph for this function:

providerTestChildAccessInheritance ( )

Data provider for testChildAccessInheritance.

Returns
array

References AccessResult\allowed(), and AccessResult\forbidden().

Here is the call graph for this function:

providerTestFormTokenCacheability ( )

Data provider for testFormTokenCacheability.

Returns
array
setUp ( )
protected

{}

References Drupal\setContainer().

Here is the call graph for this function:

testBuildFormWithClassString ( )

Tests the buildForm() method with a class name based form ID.

References FormTestBase\assertFormElement(), and Drupal\formBuilder().

Here is the call graph for this function:

testBuildFormWithObject ( )

Tests the buildForm() method with a form object.

References FormTestBase\assertFormElement(), Drupal\formBuilder(), and FormTestBase\getMockForm().

Here is the call graph for this function:

testBuildFormWithString ( )

Tests the buildForm() method with a string based form ID.

The form argument test_form_id is not a valid form.

References FormTestBase\assertFormElement(), and Drupal\formBuilder().

Here is the call graph for this function:

testBuildFormWithTriggeringElement (   $element_value,
  $input_value 
)

Tests whether the triggering element is properly identified.

Parameters
string$element_valueThe input element "#value" value.
string$input_valueThe corresponding submitted input value.

::buildForm

providerTestBuildFormWithTriggeringElement

References Drupal\formBuilder(), FormTestBase\getMockForm(), and Drupal\request().

Here is the call graph for this function:

testChildAccessInheritance (   $element,
  $access_checks 
)

::buildForm

providerTestChildAccessInheritance

References Drupal\formBuilder(), and NestedArray\getValue().

Here is the call graph for this function:

testExceededFileSize ( )

::buildForm

References FormBuilderInterface\AJAX_FORM_REQUEST, Drupal\csrfToken(), Drupal\formBuilder(), FormTestBase\getMockForm(), and Drupal\moduleHandler().

Here is the call graph for this function:

testFormCacheDeletionCached ( )

Tests that a cached form is deleted after submit.

References FormStateInterface\cleanValues(), FormTestBase\getMockForm(), UnitTestCase\randomMachineName(), FormStateInterface\setCached(), FormStateInterface\setRequestMethod(), and FormTestBase\simulateFormSubmission().

Here is the call graph for this function:

testFormCacheDeletionUncached ( )

Tests that an uncached form does not trigger cache set or delete.

References FormTestBase\getMockForm(), UnitTestCase\randomMachineName(), and FormTestBase\simulateFormSubmission().

Here is the call graph for this function:

testFormTokenCacheability (   $token,
  $is_authenticated,
  $expected_form_cacheability,
  $expected_token_cacheability,
  $method 
)

::prepareForm

providerTestFormTokenCacheability

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

Here is the call graph for this function:

testGetCache ( )

Tests the getCache() method.

References Drupal\formBuilder().

Here is the call graph for this function:

testGetFormIdWithBaseForm ( )

Tests the getFormId() method with a base form object.

References Drupal\formBuilder().

Here is the call graph for this function:

testGetFormIdWithClassName ( )

Tests the getFormId() method with a class name form ID.

References Drupal\formBuilder().

Here is the call graph for this function:

testGetFormIdWithInjectedClassName ( )

Tests the getFormId() method with an injected class name form ID.

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

Here is the call graph for this function:

testGetFormIdWithObject ( )

Tests the getFormId() method with a form object.

References Drupal\formBuilder(), and FormTestBase\getMockForm().

Here is the call graph for this function:

testGetFormIdWithString ( )

Tests the getFormId() method with a string based form ID.

The form argument foo is not a valid form.

References Drupal\formBuilder().

Here is the call graph for this function:

testGetFormWithClassString ( )

Tests the getForm() method with a class name based form ID.

References FormTestBase\assertFormElement(), and Drupal\formBuilder().

Here is the call graph for this function:

testGetFormWithObject ( )

Tests the getForm() method with a form object.

References FormTestBase\assertFormElement(), Drupal\formBuilder(), and FormTestBase\getMockForm().

Here is the call graph for this function:

testGetFormWithString ( )

Tests the getForm() method with a string based form ID.

The form argument test_form_id is not a valid form.

References FormTestBase\assertFormElement(), and Drupal\formBuilder().

Here is the call graph for this function:

testHandleFormStateResponse (   $class,
  $form_state_key 
)

Tests the handling of FormStateInterface::$response.

formStateResponseProvider

References FormTestBase\getMockForm(), EnforcedResponseException\getResponse(), FormStateInterface\getResponse(), FormStateInterface\setFormState(), FormStateInterface\setUserInput(), and FormTestBase\simulateFormSubmission().

Here is the call graph for this function:

testHandleRedirectWithResponse ( )

Tests the handling of a redirect when FormStateInterface::$response exists.

References FormTestBase\getMockForm(), EnforcedResponseException\getResponse(), FormStateInterface\getResponse(), FormStateInterface\set(), FormStateInterface\setResponse(), FormStateInterface\setUserInput(), and FormTestBase\simulateFormSubmission().

Here is the call graph for this function:

testInvalidToken (   $expected,
  $valid_token,
  $user_is_authenticated 
)

::doBuildForm

providerTestInvalidToken

References Drupal\csrfToken(), Drupal\formBuilder(), FormTestBase\getMockForm(), and FormTestBase\simulateFormSubmission().

Here is the call graph for this function:

testRebuildForm ( )

Tests the rebuildForm() method for a POST submission.

References Drupal\formBuilder(), and Drupal\request().

Here is the call graph for this function:

testRebuildFormOnGetRequest ( )

Tests the rebuildForm() method for a GET submission.

References Drupal\formBuilder().

Here is the call graph for this function:

testUniqueHtmlId ( )

Tests that HTML IDs are unique when rebuilding a form with errors.

References FormTestBase\simulateFormSubmission().

Here is the call graph for this function:

testValueCallableIsSafe (   $callback,
  $expected 
)

::valueCallableIsSafe

providerTestValueCallableIsSafe

References Drupal\formBuilder().

Here is the call graph for this function:


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